Chris Hackett scored after three minutes to give the Cobblers a precious win at Accrington Stanley.
Hackett got the only goal of the game at the Crown Ground and the side went on to collect a clean sheet and three vital points.
The win is made even more valuable by the fact that both Portsmouth and Wycombe won, meaning the gap to safety remains three points with five games left to play.
Town had a chance even before their early goal when Evan Horwood collected a throw from Matt Duke and ran fully 80 yards before firing a lot shot into the hands of home keeper Marcus Bettinelli.
He was picking the ball out of the back of his net moments later, though, when Hackett beat him to a long pass down the right channel and sidefooted calmly into the net.
Although the target was unguarded, Hackett still had a lot to do, with the angle against him, but he tucked the effort away in style to give his side the perfect start after three minutes.
Accrington enjoyed an extended period of possession after the goal but did little to concern Duke, with John Marquis skimming a header towards goal at the other end.
James Gray had Northampton hearts in mouths on 32 minutes when he beat Duke to a bouncing ball but his effort drifted wide of the far post.
Emile Sinclair could have put the game to bed in first-half injury time when he rounded Bettinelli and steadied himself for a shot with his preferred right that struck the covering Tom Aldred on the goalline.
From the second phase of the resulting corner, Darren Carter had an attempt blocked close to the target after finding himself in space but at a difficult angle.
Leon McSweeney pulled off an excellent last-ditch tackle to deny Nicky Hunt inside the box as the hosts began to mount a second-half recovery.
Dean Winnard saw a shot deflected over the bar with five minutes to play and from the subsequent corner Tom Aldred powered an attempt over the bar.
Bettinelli spilled a tame Marquis header from a Ben Tozer throw but Tozer then blotted his copybook by not putting enough on a header back to Duke, although Mathias Doumbe was on hand to block Kayode Odejayi.
Odejayi, in the game’s final minute, drew a good save from Duke with a deflected effort.
It was a tense finish for the Cobblers, not helped by four minutes of added time - in which Duke was booked for time-wasting - but they held on.
Accrington: Bettinelli, Hunt, Winnard, Aldred, Buxton, Hatfield, Murphy, Joyce, Molyneux, Gray, Odejayi
Subs: Mingoia (for Hatfield 78), Naismith (for Gray 78)
Not used: Liddle, Webber, Windass, Atkinson, Bowerman
Cobblers: Duke, McSweeney, Diamond, Doumbe, Horwood, Hackett, Carter, Ravenhill, Morris, Marquis, Sinclair
Subs: Connell (for Sinclair 70), Tozer (for Hackett 78)
Not used: Snedker, Deegan, Toney, Robertson, Dickenson
Away fans: 410