Cobblers required a dramatic late equaliser from Kevin van Veen and then nerves of steel from the penalty spot to secure their place in the third round of the Checkatrade Trophy at the expense of Cambridge United on Tuesday.
Town had over 80 minutes to get back into the game once George Maris blasted United in front early on, but they seldom looked like doing so and it appeared for all the world that Keith Curle's men were heading out of the competition.
Dramatically, though, they were given a lifeline by Kevin van Veen, who came off the bench score in the very last minute, and they grabbed it with both hands by going on to win the subsequent shoot-out.
Ash Taylor hit the crossbar with his attempt, but van Veen, Sam Foley and Billy Waters all scored their efforts, leaving the stage clear for Shaun McWilliams to slam home the winning penalty and put Cobblers within three games of a Wembley final.
A mention should also go to goalkeeper Lewis Ward who made amends for a couple of unconvincing moments during the game with two excellent penalty stops.
Junior Morias returned from suspension to make just his seventh appearance of the season and young Jay Williams was given another opportunity to impress by Keith Curle, but Matt Crooks remained absent.
Curle also reverted to 3-5-2, but his side were behind with just nine minutes on the clock when a mix-up at the back allowed Maris to skip past Jordan Turnbull's sliding challenge and hammer beyond Lewis Ward at his near post.
United's set-pieces troubled a shaky-looking Cobblers defence throughout the first-half as Jabo Ibehre almost headed in a second before Turnbull's perfectly-timed sliding tackle prevented the striker from getting in on goal.
Dimitar Mitov made straightforward saves from Morias and Andy Williams, but he was eventually forced into more strenuous action, reacting smartly after Shay Facey's first-time cross took a double deflection off Morias and then a United defender.
Ward tipped over Jevani Brown's dipping strike but Cobblers had the better of things either side of half-time with Morias whipping a shot just wide of the far corner moments after the resumption.
Cambridge recaptured the upper-hand though, Ward blocking from Brown and then Maris fluffing his lines when found unmarked at the back post, passing up the chance to score his and United's second when side-footing horribly wide.
With his side's hopes of progressing diminishing by the minute, Curle rolled the dice midway through the second-half by making a triple substitution with Daniel Powell, Kevin van Veen and Morgan Roberts all thrown on.
The away side's attacking threat dwindled as the second-half progressed, but just as it appeared time was running out, they dramatically pulled level out of the blue.
Following an almighty scramble in the six-yard box, which saw Mitov and several defenders somehow keep the ball out on numerous occasions, two substitutes combined in the final minute of normal time when Powell's cross was diverted into the bottom corner by van Veen's out-stretched foot.
That sent the tie straight to a penalty shoot-out and Ward was the hero, saving United's first two spot-kicks before van Veen, Waters, Foley and McWilliams did the rest.
Cambridge: Mitov, Halliday, Taylor (Amoo 90), Deegan (c), Dunk, Darling, Maris, Lambe, Brown, Lewis (O'Neil 80), Ibehre (Azees 80)
Subs not used: Forde, Taft, Osadebe, Davies
Cobblers: Ward, Facey, Taylor, Turnbull, Buchanan (c) (Roberts 67), Foley, McWilliams, Waters, J Williams, A Williams (van Veen 67), Morias (Powell 67)
Subs not used: Coddington, Odoffin, Bowditch, Bridge
Referee: Brett Huxtable
Cobblers fans: 134