Leon McKenzie was spot on to end Northampton's run of five straight defeats in a 2-1 win at home to Gillingham.
The visitors took the early lead through Chris Palmer but Dean Beckwith equalised against his former club, leaving McKenzie to hit the winner from the penalty spot.
Palmer gave Gillingham a seventh-minute lead, rounding off a cleverly worked free kick involving himself, Kevin Maher and John Nutter.
Facing a seventh straight defeat, Northampton hit back and Nathaniel Wedderburn volleyed just wide before Beckwith equalised in the 20th minute, powerfully heading home at the far post on his return from a three-match ban from Ryan Gilligan's corner.
McKenzie volleyed over and Andy Holt saw his near post header tipped over by Alan Julian before Northampton grabbed what proved to be the winner in the 39th minute.
Matt Lawrence fouled Beckwith from a set piece in the box and from the ensuing spot kick McKenzie sent Julian the wrong way.
Chris Dunn saved bravely at Cody McDonald's feet just before the break but after the interval neither side created much.
Adebayo Akinfenwa headed over and then saw a shot on the turn saved by Dunn but rarely threatened against his former club.
Copyright (c) PA Sport 2009, All Rights Reserved.