Cobblers suffered late heartbreak at the Priestfield Stadium on Saturday when Jay Emmanuel-Thomas struck an injury-time winner to hand Gillingham a dramatic 2-1 victory.
Both sides appeared content with a point in a keenly-fought contest that saw Northampton pegged back after leading at half-time, only for Emmanuel-Thomas to have his say when stroking home an excellent finish to snatch all three points for his side.
Gillingham's last clean sheet in a league game came seven months and 22 games ago but despite their recent slide down the Sky Bet League One table, they bossed the early exchanges and kept Northampton very much on the back foot.
A failure to turn pressure into clear-cut chances proved their downfall, however, and while their bright start fizzled out, the Cobblers only improved and gradually turned the tide before taking a lead into half-time through John-Joe O'Toole's close-range header.
Northampton lost all of their momentum within moments of the restart, though, when Max Ehmer powered in an equaliser and after both sides spurned chances, it was Gillingham who ultimately prevailed with a last-gasp strike.
It was a disappointing afternoon for Town and their hardy travelling fans on a grim afternoon in Kent, and the visitors will be frustrated by the manner of the defeat as much as anything because it was they who looked the likelier to win it before Emmanuel Thomas popped up.
Cobblers, who were bidding to make it three successive victories, drop one place to seventh in Sky Bet League One as a result of this defeat.
Without Gabirel Zakuani, who's on international duty, and the injured Jak McCourt, Northampton made two changes from their last league outing as O'Toole came into midfield and Lewin Nyatanga partnered Zander Diamond at the heart of defence.
Billy Knott proved an early nuisance for the Northampton back four as he twice found space outside the penalty area, first blazing a few yards over and then having a shot blocked behind for a corner.
Gillingham, playing with more energy and intensity, had made the brighter start and didn't look a team who've gone seven league games without a victory, with Jay Emmanuel-Thomas fizzing successive shots wide and then firing too close to Adam Smith
Cobblers were struggling to get a foothold and spent too much time inside their own half, and calamity almost struck on 18 minutes when Brendan Moloney had to retrieve his own back header and clear off the line after it had beaten Smith all ends up.
There was no doubt as to which team was on top, however for all Gillingham's early pressure, Northampton almost went ahead against the run of play as Stuart Nelson denied Sam Hoskins from an acute angle before O'Toole was just unable to reach Matty Taylor's in-swinging cross.
At the other end, Knott appeared on a one-man mission to score when firing two further long-range attempts off target but aside from speculative pot shots, Gillingham's promising start had rather fizzled out.
Northampton gradually grew into the game, by contrast, and a spell of pressure shortly after the half-hour mark had its reward when culminating in the opening goal.
After Hoskins and Moloney combined well down the right, Cobblers won a succession of corners, one of which led to Zander Diamond heading Taylor's delivery back across goal and there was O'Toole waiting to nod in, the ball just about squirming between two defenders and over the line.
Max Ehmer whistled a first-time shot inches wide as Gillingham sought an immediate reply before JJ Hooper unleashed his own pile-driver narrowly over the crossbar as Town finished the first-half on top.
And they were agonisingly close to doubling their lead prior to half-time when Hooper wriggled free inside the penalty area and shot off the post via a deflection.
That kept the lead to just one, and the importance of that moment only looked potentially decisive within three minutes of the restart.
In similar fashion to Northampton's opener, Gillingham drew level when the visitors failed to deal with a corner and the ball fell kindly for an unmarked Ehmer, who duly leathered into the bottom corner.
That opened the game up as O'Toole immediately headed wide from a Northampton corner before a brilliant block by Paul Anderson denied Frank Nouble an almost certain goal.
Much like the first-half, Gillingham carried the greater and more consistent threat while the Cobblers posed their own problems on the break, however what seemed an exciting finish rather petered out into a scrappy period of the game.
But Northampton had an excellent chance to restore their lead when, with 10 minutes remaining, substitute Kenji Gorre, who had replaced the injured Hooper moments earlier, slipped through Moloney but Gillingham keeper Stuart Nelson rushed out to block the full-back's shot.
Thereafter, chances and excitement continued to dwindle in equal measure, though the visitors did look the more threatening, but there was to be one last twist in the tail when Gillingham attacked in the second of five added minutes.
Cobblers were unable to clear a low cross from the right and the ball fell back out to Emmanuel-Thomas, who worked space for himself on the edge of the area before placing a 20-yard shot into the bottom corner.
Northampton desperately attempted to reply but Gillingham comfortably saw out the remainder of injury-time to take the spoils.
Gillingham: Nelson, Jackson, Ehmer, Hessenthaler, McDonald, Knott, Konchesky, Cargill, Wright (c), Nouble (Dack 64), Emmanuel-Thomas
Subs not used: Hadler, Oshilaja, Garmston, Osadebe, Wagstaff, Donnelly
Cobblers: Smith, Moloney, Diamond, Nyatanga, Buchanan, O'Toole, Taylor, Hoskins, Anderson, Hooper (Gorre 78), Richards (c) (Revell 58)
Subs not used: Cornell, Hanley, Byrom, Beautyman, Potter
Referee: Lee Probert
Cobblers fans: 637