Following a dismal start to the season, things were finally starting to look rosier for the Rossoneri after a thumping victory over Chievo saw them climb into the top half of the table last week.
But Alexandre Pato failed to peg back Vincenzo Montella's Viola before the break, missing a penalty after Alberto Aquilani managed to open his goalscoring account for the Tuscans.
Borja Valero then beat Christian Abbiati to give Fiorentina a two-goal lead but substitute Giampaolo Pazzini hit back on the hour mark to give Milan hope.
But there was ultimately no way back for a toothless Milan side when Mounir El Hamdaoui made the visitors' points safe at the death with a long-range screamer.
Aquilani and Riccardo Montolivo were facing their old clubs for the first time, but it was the Viola's summer signing that hurt his former employers after 10 minutes.
Respectful celebrations followed as Aquilani appeared out of nowhere to burst into the box and slam the ball past a surprised Abbiati.
Milan almost hit back immediately, Urby Emanuelson denied only by a braving sliding tackle, before Facundo Roncaglia spurned a solid opportunity at the other end.
The Fiorentina defender had his head in his hands, though, when his clumsy challenge on Pato won Milan a penalty in the 34th minute.
But the Brazilian striker neglected to level the tie, instead blasting the ball high over the bar and into the upper tiers.
And Fiorentina ensured their hosts would be jeered off at half-time as Valero bobbed and weaved into the box to beat Abbiati with ease.
Philippe Mexes had perhaps been to blame for failing to contain Valero but the Frenchman set up the Rossoneri's response as play resumed.
Stephan El Shaarawy drilled a cross into the Fiorentina box, Mexes instinctively backheeling the ball against a post for Pazzini - who replaced Pato at the break - to steer home the wild rebound.
Allegri soon threw on Robinho in search of a quickfire equaliser, but midfielder Kevin-Prince Boateng came closer to levelling the scores with a drive that Roncaglia did well to deflect away.
Mattia Cassani might have only found a post having been one-on-one with Abbiati, but El Hamdaoui ensured a 3-1 victory for Fiorentina with his unsaveable bending drive two minutes from time.