Milan fell behind 3-1 following two goals from Udinese's Antonio Di Natale, who raised his league-leading total to 13, but an own goal from Mehdi Benatia and Alexandre Pato's second goal in the 82nd minute drew Milan even at 3-3.
Argentine forward German Denis put Udinese back in front in the 84th and Ibrahimovic equalized in the third minute of added time after collecting a pass inside the area from Antonio Cassano, who has now set up two goals in his first two matches with Milan.
Five-time defending champion Inter Milan also struggled before winning 2-1 at Catania.
Alejandro Gomez gave the Sicilian club the lead in the 71st before Esteban Cambiasso hit back in the 75th and 79th to hand new Inter manager Leonardo his second consecutive win since replacing Rafa Benitez.
On a day in which all of the top teams looked in trouble at some point, Lazio lost 2-1 at home to Lecce and Brazil defender Juan made two costly errors as Sampdoria rallied to beat 10-man AS Roma 2-1.
Lazio goalkeeper Fernando Muslera was charged with an own goal in the 39th, Stefano Mauri equalized for the hosts in the 47th but Carlos Grossmuller put Lecce back ahead in the 72nd.
Milan led with 40 points, six in front of Lazio. Napoli was next with 33 points, AS Roma has 32 and Juventus and Palermo 31 each.
Inter, which has two games to make up, is seventh with 29 points.
Napoli was set to host Juventus later, Also, it was: Bari 0, Bologna 2; Cesena 0, Genoa 0; Chievo Verona 0, Palermo 0; Fiorentina 3, Brescia 2; and Parma 1, Cagliari 2.
In the new lunchtime fixture, Mirko Vucinic put Roma ahead in the 18th, taking advantage of a stagnant defense. But in the 55th, Juan gifted the ball to Angelo Palombo and Roma goalkeeper Julio Sergio tripped the Sampdoria captain, drawing a red card and a penalty which was converted by Nicola Pozzi.
Stefano Guberti then scored the winner in the 83rd when Juan was unable to clear.
"They were two errors, but two errors from a great champion and that can happen over the course of a career," said Roma coach Claudio Ranieri.
Sampdoria ended with nine men after Stefano Lucchini and Daniele Guastaldello picked up their second yellow cards in the final five minutes.
Having joined on a six-month loan from Manchester United, Federico Macheda made his Samp debut in the final 13 minutes and wasted an excellent scoring chance a minute before Guberti's winner, heading wide.