Teenage striker Jordan Robertson came off the bench to earn Northampton a precious point in their battle against relegation and deny Gillingham a rare win on their travels.
Robertson has yet to start a match in a Cobblers shirt since arriving on loan from Sheffield United, but this is the second time the 18-year-old has come on to score and he will be pressing for a place in the starting line-up when Northampton play at Brentford on Monday night in front of the television cameras.
The home side looked like crashing to a fifth straight home defeat after Dean McDonald nodded the visitors in front on the hour, but Robertson came up trumps with just four minutes left on the clock.
The goal had an element of luck as Gillingham's Danny Jackman saw his attempt to kick the ball into touch blocked, allowing Sam Aiston to dash into the box before squaring the ball for Robertson to coolly slot home.
It was no more than the home side deserved as Gillingham had shown little in attack, although they went ahead when Northampton failed to deal with a Matthew Jarvis corner, allowing McDonald to score with a looping header.
Aiston almost equalised ten minutes from the end when he carved out a chance from nothing before cracking a right-foot shot against the crossbar.
Even after the equaliser, Robertson had a chance to bag all three points after a slip from Leon Johnson but the youngster fired into the side-netting.
The first half saw Northampton dominate without applying the finishing touch. Andy Kirk was denied by an excellent one-handed save from Romain Larrieu in the 22nd minute after the striker turned and fired in almost one motion. A minute later a header by Alex Pearce came back off the post.
Gillingham were counting their lucky stars six minutes later when Johnson blocked a ferocious volley by Mark Hughes which seemed destined for the net, before the visitors responded with a great strike by Michael Flynn which sailed just wide.