Shay Given saved two penalties as Manchester City snatched a place in the UEFA Cup quarter-finals despite a dramatic late collapse in Aalborg.
Protecting a 2-0 lead from the first leg, City were five minutes from progressing in normal time when the Danes staged a late fightback through Luton Shelton and Michael Jakobsen to bring the tie level at 2-2 on aggregate.
It was left to Given to spare City's blushes and he delivered by keeping out spot-kicks from Thomas Augustinussen and former Sheffield United forward Shelton to hand City a 4-3 win in the shoot-out.
It was the second time in the competition City had been taken to penalties by Danish opposition after a dramatic win over Midtjylland in the second qualifying round in August.
The win kept alive City's hopes, as the last remaining English side in the event, of winning a first major piece of silverware since 1976.
Yet, on a bitterly cold night at the Energi Nord Arena, City were almost made to pay for their failure to kill off a tie they had dominated.
Robinho was again below par away from home and was taken off in extra-time, although the Brazilian almost put City through when he hit the crossbar after 83 minutes.
Aalborg, despite needing to chase the game, opted for a safety-first approach in the first half out of fear of conceding an away goal.
Only after the break did they begin to show any urgency but the tactic paid off dramatically as they turned the tie on its head in a frantic finale.
Until then City, despite playing cautiously themselves, made most of the early running in a contest that lacked bite.
Robinho, fit to feature after concerns over an ankle injury, looked to create an opening after collecting a crossfield ball from Wright-Phillips but his shot was blocked.
Ched Evans also shaped to shoot after a Wayne Bridge cross ran through the box but his first touch was heavy and the opportunity passed.
Stephen Ireland, the game's most industrious player early on, got in the first clear shot at goal with 16 minutes gone but his effort flew over.
Aalborg offered little until Kasper Bogelund found space on the right but his tame cross was gathered by Shay Given.
Anders Due then sent a more dangerous cross into the City box but Nedum Onuoha was alert and beat Shelton to the ball at the expense of a corner.
Jamaica international Shelton was also thwarted by Onuoha as he tried to cross after finding room on the right.
Robinho jinked his way to the byline as City pushed late in the first half but goalkeeper Karim Zaza stopped his ambitious shot with his foot.
Pablo Zabaleta curled in a shot after the ball broke to him from the resulting corner but it drifted wide.
Aalborg had the first of several penalty appeals early in the second half when Kasper Risgard went down under Vincent Kompany's challenge as Jakobsen floated in a cross.
French referee Stephane Lannoy was unimpressed and City almost caught Aalborg on the break as Ireland set up Evans but the Welshman somehow managed to clear the stand from 10 yards.
City then survived a scare as Shelton nodded down to Caca but the Brazilian's low drilled shot just went wide of Given's left-hand post.
Aalborg had stronger and more vociferous penalty claims turned down on the hour when substitute Javier Garrido felled former Wigan player Andreas Johansson in a 50-50 challenge.
Lannoy was immediately surrounded by home players but City were reprieved.
Aalborg finally began to up the tempo and a low ball beat all in the City box but the visitors managed to clear.
Michael Beauchamp tried to win another penalty but was booked for diving, Johansson had a shot deflected for a corner and Shelton forced Given to save one-handed.
City's attacks were becoming rarer but Robinho went close to settling the tie seven minutes from time when he hit the woodwork after Ireland reached the byline.
City then paid the price for failing to kill off Aalborg as the Danes remarkably broke through twice in the dying moments.
First Shelton blasted home from close range as the ball bounced up invitingly inside the area from a right-wing cross.
That set up a nervy finale and City were unable to hang on as Evans handled a Jakobsen header in the last minute.
This time the referee did point to the spot - at the fourth time of asking - and Jakobsen stepped up to smash into the top of the net from the spot.
The visitors looked tired but neither side could create a meaningful opportunity in the additional periods.
It came down to penalties and City comfortably tucked away all four of theirs while Given saved from Augustinussen and Shelton.