Daniel van Buyten's strike deep into injury time left Bayern Munich as favourites to progress against AC Milan in the Champions League quarter-final.
Van Buyten was Bayern's hero with two goals at the San Siro
Andrea Pirlo's 40th-minute header gave Milan a deserved lead at half-time.
But Van Buyten turned in from close range to draw Bayern level and score a crucial away goal with 12 minutes left.
Kaka put Milan back in front from the spot after he was wrongly adjudged to have been fouled by Lucio, but Van Buyten then levelled from the angle.
Bayern turned to youngster Michael Rensing to deputise for the vastly-experienced Oliver Kahn, who was suspended - and he produced two world-class saves as Milan dominated the opening half.
Milan threatened as early as the second minute, when Clarence Seedorf was only inches away from connecting with Marek Jankulovski's cross at the far post.
And Ambrosini held his head in disbelief as Rensing turned away his point-blank header from Massimo Oddo's corner.
Rensing then produce arguably an even more sensational save from Gilardino 10 minutes before the interval, clawing away a header from only six yards as Bayern were undone by another Oddo cross.
Milan deserved to be ahead, and even Rensing's defiance was powerless to stop them finally taking the lead after 40 minutes.
Oddo's cross found Pirlo at the far post, and his header looped beyond Rensing.
The tale of Milan domination continued after the break, with a Gilardino lob ruled out for offside, and Kaka failing to connect with Jankulovski's cross when the merest of touches would surely have brought a goal.
But Milan's failure to add the second was punished with 12 minutes left when Hasan Salihamidzic's cross was headed across the face of goal by Claudio Pizarro and Van Buyten turned past Dida from close range.
Milan were back in front with six minutes left - thanks to a shocking penalty decision by referee Yuri Baskakov.
Lucio's perfect tackle on Kaka was adjudged to be a foul, but the Brazilian was not complaining as he regained his composure to send Rensing the wrong way from the spot.
Bayern were rightly furious, but justice was done with only seconds left, Van Buyten flashing an angled drive past Dida after Milan failed to clear a long ball into the box.
Milan coach Carlo Ancelotti:
"The team deserved to win for what it did. Bayern has a better chance of qualifying now but I think we were the better team. We need to regroup.
"However, we can draw strength from our performance tonight."
Bayern coach Ottmar Hitzfeld:
"It was a really great match, full of emotion and surprises. We deserved the draw given the way we fought until the very end.
"Milan was definitely the better team in the first half and Rensing was truly excellent. So, we're very grateful to him."
AC Milan: Dida, Oddo, Nesta, Maldini, Jankulovski (Kaladze 87), Gattuso, Pirlo, Ambrosini, Seedorf (Gourcuff 85), Kaka, Gilardino (Inzaghi 71).
Subs Not Used: Kalac, Cafu, Bonera, Brocchi.
Goals: Pirlo 40, Kaka 84 pen.
Bayern Munich: Rensing, Sagnol (Lell 67), Lucio, Van Buyten, Lahm, Salihamidzic, Hargreaves, Ottl, Schweinsteiger, Makaay (Santa Cruz 86), Podolski (Pizarro 68).
Subs Not Used: Dreher, Scholl, Gorlitz, Demichelis.
Booked: Salihamidzic, Van Buyten.
Goals: Van Buyten 78, 90.
Ref: Yuri Baskakov (Russia).