Marton Fulop pulled out all the stops to spare Sunderland's blushes as they scraped through to the next round of the Carling Cup by the skin of their teeth.
League One side Northampton Town looked to have completed a dream double of Premier League scalps as they went into a 2-0 lead at the Stadium of Light.
The Cobblers had beaten Bolton Wanderers in the previous round and looked good value for another giant-killing against a Sunderland team who weren't at the races early on.
The visitors certainly weren't overawed by the occasion and took the game to their hosts from the off.
Sunderland failed to show similar commitment and as a result were deservedly behind after 20 minutes.
A long ball out of defence was met by the head of Leon Constantine who flicked on for Colin Larkin.
The striker raced on to the ball and blasted it past Fulop and into the net.
If the Wearsiders were in need of a wake-up call then surely this was it but, while the host team stepped things up, they were still a way off getting back into the contest.
They did, however, go close to levelling the scores as David Healy brought a good save out of Frank Fielding on 32 minutes.
Fielding was again called into action in the dying moments of the first half, pulling off a great save to deny Dean Whitehead who rifled in a volley from the edge of the area.
Black Cats boss Roy Keane rang the changes after the break as he replaced Healy and Carlos Edwards with Michael Chopra and Kieran Richardson at the start of the second half.
Chopra had come off the bench to fire in a brace at the weekend to ensure victory over Middlesbrough.
But it was to be another super sub who kept the Black Cats in it against Town.
Anthony Stokes, a 78th minute replacement, for the injured Grant Leadbitter was the man who took over the mantle from Chopra.
However, that was not before Northampton looked to have put the game beyond doubt.
Goalscorer Larkin turned provider crossing in for Luke Guttridge to fire in Town's second on 80 minutes.
To add insult to injury for the Wearsiders, Nyron Nosworthy limped out of the action to reduce his side to 10 men with all three substitutes having already been used.
But then came the late-late show, Stokes poking home on 85 minutes to give the hosts one last throw of the dice and in time added on the Irishman sealed his double heading in off the bar to send the game into extra time.
There was no separating the two sides in the extra 30 minutes so it was down to penalty kicks to settle the final result.
Then it was Fulop's chance to shine as thee Sunderland keeper saved Constantine's effort to give the Wearsiders a 4-3 win.
It was heartbreak for Town and far more than the hosts deserved, but the Sunderland fans won't worry too much about how their side progressed to the next round, but will rather be breathing a huge sigh of relief that they managed to come back from the dead.