Rochdale striker George Donnelly struck a stoppage-time winner as the Cobblers paid the price for yet another five minutes of madness to lose a game they led for long periods at Spotland.
The home side’s left-back Michael Rose looked like he had done enough to secure a draw for Dale with a curling free-kick to level the contest after 85 minutes.
But Donnelly went one better in the first minute of injury time, producing a shot that had too much power for Matt Duke and trickled into the net to put the seal on a 3-2 victory.
Such an outcome looked highly unlikely when Luke Norris put Town in front after just 26 seconds only to see his effort cancelled out by a goal from former Cobbler Ian Henderson.
Stuart Dallas restored Northampton’s advantage and they appeared to be well in control of things before a five-minute capitulation that saw all the points head to Rochdale.
The teams hadn’t even had time to break a sweat when Norris made an impact on the game, collecting the ball in space in the inside-right channel and opting against the simple pass to Hackett on the right wing.
Instead he took an extra touch and fired an unstoppable looping shot over Josh Lillis in the Dale goal; Lillis might have done better with the shot but there was no way he would have expected Norris to shoot from such an improbable distance and range.
The injury curse continues to plague Northampton and did so again in this game when Kevin Amankwaah was withdrawn with what looked like a calf injury.
Amankwaah immediately signalled to the bench to come off, and was replaced at right-back by Lee Collins.
The lead with have sent Town into a defensive stance but they continued to attack and Darren Carter saw a low shot well held by Lillis at his near post after a Hackett-led break down the left.
But Rochdale pulled level with their first shot on target, Henderson returning to haunt his former employers with a degree of inevitability but with a goal that should have been avoided.
A long ball into the box was headed more up than away by Paul Reid, the ball spun away from Gary Deegan and Henderson made a good enough contact with his left foot to beat Matt Duke from an acute angle.
Carter was central to Dallas’ goal, which came seven minutes before the break and was brutally emphatic.
Town’s number four cushioned an aerial pass on his chest and turned on it in a single move before threading a pass out to the right-winger with precision weight.
Dallas had no thoughts of producing a cross and instead advanced almost to the byline, from where he struck a venomous shot past Lillis’ left hand.
Dale rallied and Rose drilled a first-time shot against the outside of the post just before the break and immediately after it Andrew Tutte drew a good save from Duke with a shot from 20 yards.
Further action, though, was greatly limited in the second half, with the Cobblers - and there is no other expression for it - wasting time at every opportunity and Rochdale changing their formation twice in an attempt to find a way into the game.
Mathias Doumbe made a fine block to smother a Henderson shot in the final 10 minutes and Hackett tested Lillis’ powers of concentration with a low shot which he caught on the bounce.
With five minutes to go, Deegan collided with Jamie Allen to present the home side with a free-kick no more than 20 yards at goal.
Donnelly shaped to strike it but it was left-back Rose who delivered a pinpoint-accurate sidefooted shot around the left of the three-man wall and inside Duke’s post.
That was heartbreaking enough for Town but worse was to come as the game entered its 90th minute, with Donnelly breaking clear at a counter-attack and notching the winning goal.
Rochdale: Lillis, Rafferty, Lancashire, O’Connell, Rose, Vincenti, Dicker, Lund, Hery, Henderson, Cummins
Subs: Tutte (for Lund 43), Donnelly (for Cummins 52), Allen (for Hery 67)
Not used: Bennett, Eastham, Thomson, Bunney
Cobblers: Duke, Amankwaah, Reid, Doumbe, Widdowson, Hackett, Morris, Carter, Deegan, Dallas, Norris
Subs: Collins (for Amankwaah 14), Toney (for Norris 74)
Not used: Demontagnac, Tozer, Emerton, McNamara, Harriott
Away fans: not given
Referee: Michael Naylor