Town's top scorer Junior Brown gave the visitors the lead after 20 minutes, latching on to to David Ball's shot to divert the ball past Stuart Nelson.
They doubled their advantage eight minutes later, as an unmarked Alan Goodall headed in from Barry Nicholson's inswinging corner.
Gillingham pulled themselves back into game shortly before the break, as Charlie Lee latched on to Charlie Allen's delivery to fire past Scott Davies on 42 minutes.
And only Goodall's heroics prevented Romain Vincelot from blazing home an equaliser deep into first-half stoppage time.
The hosts were buoyed by the introduction of Myles Weston after the break, and after Lee and Danny Kedwell came close to levelling the scores, it was the substitute who finished from close range to tie the match.
Neither side looked like getting a winner, although Brown thought he had given Town all three points late on, only to see his effort ruled out for offside.