Mihajlovic was rumoured to be facing the sack had Milan lost, with the team having won only one of their previous five Serie A matches.
But Carlos Bacca eased Milan's nerves with a well-taken fourth-minute goal and Boateng, who this month rejoined the club where he played between 2010 and 2013, came off the bench to seal the victory.
"This was a perfect day. There's nothing better than scoring at San Siro," 2010-11 Scudetto winner Boateng told Mediaset Premium.
"It was an important game for us, for many reasons. We wanted to win and we did it, so we are very happy. It wasn't easy to beat Fiorentina."
Boateng went on to dedicate the victory to the coach, whose side climbed to sixth spot in Serie A.
"This is a victory for Mihajlovic and all the Milanisti," said the 28-year-old midfielder, his Schalke contract having been cancelled in December after disciplinary problems.
"I am here to work and I want to do well. I thank the coach and the president. This goal is important for me."