Milan hold on to secure a 3-1 victory over Parma, despite playing the final half an hour with 10-men after Ibrahimovic was sent off for dissent.
They led 2-0 at the break and looked comfortable, thanks to goals from Ante Rebic in the eighth minute – a strike that was brilliantly set up by Ibrahimovic – and a fine Franck Kessie finish on the stroke of halftime.
However, after Ibrahimovic was shown a straight red card, Parma began to press forward and got their reward on 66 minutes, when Gagliolo scored.
Veteran striker Graziano Pelle then brilliantly set up Gagliolo to get Parma back in it six minutes later.
What Ibrahimovic said to receive his eighth dismissal in Europe’s top-five leagues is unclear, as he did not even appear to be close to the referee when he brandished the red card, but it changed the complexion of the game.
The hosts pushed for an equaliser, but couldn’t find a way through and the visitors punished them in stoppage time.
Milan broke clear in stoppage time, with Diogo Dalot setting up Leao for the substitute’s first goal since early January which sealed the visitors their 13th Serie A away win this season.
As Stefano Pioli’s men closed the gap to Inter Milan to eight points, with the league leaders facing Cagliari on Sunday.
Parma remain 19th in Serie A, four points from safety and they face Cagliari next time out.
A run of just one win in their previous five matches in all competitions was threatening to unravel Milan’s season, but the visitors raised their game early on against Parma, scoring a fine opener.
Meanwhile Milan strengthen their hold on second place, ahead of their game against Genoa next weekend.