After seeing his side fall behind early on, the forward once more played a pivotal role as he equalised against the 10-man Rossazzurri before netting a brilliant second late on
Despite a positive start, the visitors found themselves one down after 11 minutes when Nicola Legrottaglie nodded in the opener.
An incoherent Rossoneri outfit struggled to worry the hosts thereafter but they received a massive boost when Pablo Barrientos was dismissed early in the second half. Stephan El Shaarawy equalised moments later and, after Kevin-Prince Boateng scored the second before being sent off, the 20-year-old bent in a sublime strike to seal Milan's third win in a row in all competitions.
Confident from their victory over Juventus last weekend, Milan instantly took hold of possession during the early exchanges. It took them just six minutes to forge their first chance but a strong hand from Mariano Andujar kept Boateng's driven effort out.
But five minutes later they surprisingly fell behind. Some painfully static defending enabled Legrottaglie to stroll into the box and send a bullet header home from Francesco Lodi's corner.
More shoddy defensive play from the Rossoneri presented the hosts with a fantastic chance to double their advantage soon after. Sergio Almiron was allowed time and space in the six-yard box but his header lacked conviction and went wide of the goal.
Milan's forwards were extremely isolated, with Riccardo Montolivo's efforts to link up with the front three being hindered by a lack of movement and support.
Yet once again the Diavolo's hesitant back line came close to costing them another goal 10 minutes before the break.
Excellent pressing from Gonzalo Bergessio enabled Barrientos to steal the ball from Kevin Cosntant inside the area but the latter's blushes were spared as Mattia De Sciglio hooked the Argentine's cross away from danger.
The onus was on Allegri's men as they emerged for the second half but they were offered a helping within five minutes of the second half when Barrientos took a wild and unnecessary swipe at Antonio Nocerino which earned him a second yellow card and reduced his side to 10 men.
It did not take long for Milan to make their man advantage count as, from Boateng's cross, El Shaarawy restored parity from an offside position following a touch from Robinho, Serie A's top scorer lifting the ball over Andujar in the 53rd minute.
The turnaround was completed just three minutes later as Boateng turned Lodi with ease at the top of the box before bending a brilliant shot into the corner of the net while the keeper stood idly by.
El Shaarawy and Robinho both wasted fantastic chances to enhance upon their side's lead and Urby Emanuelson failed to finish following a melee in the area as his shot came back off the post.
Boateng was dismissed in the final minute of normal time for a challenge from behind but El Shaarawy ensured no bitter taste remained with a spectacular second that he bent into the top corner with his right foot.
Victory moves Milan above Catania and into seventh place, though that could change depending on the weekend's other results.