Two goals in the last five minutes spared Jose Mourinho's blushes at Dynamo Kiev and reignited Inter Milan's Champions League campaign.
Andrey Shevchenko, a legend at Inter's city rivals AC Milan, scored the only goal of the first half after 21 minutes and it looked like being enough for a shock win.
Inter piled on the pressure in the second period and it finally paid off as the in-form Diego Milito equalized in the 86th minute and Wesley Sneijder won it one minute from time.
Even a draw would have kept the Italians bottom of Group F, but as it was they went top - a point ahead of Rubin Kazan and Barcelona.
In just the second minute, Sneijder fired over the bar, while at the other end Milos Ninkovic could not find the target from distance.
After 18 minutes Samuel Eto'o sent a wicked strike over from a narrow angle - and just three minutes later his side were behind.
Artem Milevskiy controlled Roman Eremenko's throw into the path of Shevchenko, who controlled the ball on his chest before sending a looping volley over the reach of Julio Cesar.
Both sides produced some slick football, with one well-worked move from Inter finishing with a one-two between Diego Milito and Walter Samuel, but the former fired straight at Stanislav Bogush when he should have done better.
Shevchenko had chances for a second but could not match his earlier deadly finishing, first straying offside on the counter-attack to prevent a good chance, then pulling a shot wide from the edge of the box.
Mourinho made a double switch at half-time, bringing Mario Balotelli and Thiago Motta on for Esteban Cambiasso and Cristian Chivu.
Inter took the initiative from the restart, Dejan Stankovic firing from distance but preventing an easy save for Bogush.
After 50 minutes, Sneijder swung in a free-kick from right wing and Samuel flung himself at the ball, but his diving header was off target.
Just after the hour mark, Shevchenko headed the ball to Ninkovic, who took the ball away from Lucio with a neat first touch before dragging the ball just wide of the near post.
Milito then tried his luck but could not beat Bogush from an acute angle.
A string of set-pieces caused trouble for Bogush, never more than when Sneijder's delivery was headed onto the post by Samuel.
Samuel then touched the ball wide after being played in by a neat Eto'o through ball.
It looked like being Dynamo's day, but four minutes from time, Sneijder picked out Milito, who was all alone on the edge of the Dynamo box, and his scuffed shot caught Bogush off balance before dribbling over the line.
And moments later when substitute Sulley Muntari sent in an angled shot, Bogush allowed the ball to squirm under his body.
It was going just wide, but Milito turned the ball from an impossible angle against the keeper's knees and Sneijder followed in.
It was heartbreaking for Dynamo, but they contributed to their own downfall with some slack defending late on.