Milan took the lead through Zlatan Ibrahimovic's emphatic first half penalty, after Maxi Lopez was fouled by Matija Nastascic.
Fiorentina hit back two minutes into the second half through Steven Jovetic, who beat the offside trap and finished well.
But in a dramatic finale, Amauri collected Jovetic's pass and calmly stroked in from close range to seal a famous win and boost Fioentina's chances of Serie A survival.
His former club Juventus, who are chasing their first Scudetto since 2003, are now only two points behind Massimiliano Allegri's side with a game in hand.
After their disappointing 1-1 draw at Catania last week, Milan were looking to get their campaign back on track with a home game against one the division's struggling sides.
But the Rossoneri made a sluggish start at the San Siro, allowing early openings for Jovetic and Houssine Kharja in the early stages.
Sulley Muntari missed a simple chance to give Milan the lead when he blazed over from close range after Ibrahimovic’s thunderous free-kick was parried by Artur Boruc.
But Milan didn’t have to wait much longer before they took the lead courtesy of Ibrahimovic’s expertly taken low penalty after Maxi had been hauled to the ground by Nastascic in the box.
Milan continued to push for a second before the break, with Maxi coming closest with a thumping effort that came back off the base of the far post.
But the pendulum swung Fiorentina's way when they drew level little over a minute into the second half, when Jovetic timed his run to perfection to collect Lorenzo De Silvestre's pass and slot under Abbiati.
Milan saw far more of the ball than their opponents as chances came and went for Urby Emanuelson - who was denied from seven yards after Nastasic's brilliant block - and Maxi, whose shot from only three yards out was smothered by Boruc.
Fiorentina always possessed a threat on the break and had a couple of great chances to take the lead before they did, with Jovetic the main culprit, twice finding Christian Abbiati after Milan had been carved open on the break.
But the Montenegrin played a vital role in the winner as he rolled the ball across from the right to Amauri, who took a touch and buried his shot under Abbiati from six yards - blowing the title race wide open again.