Alex Lawless’ side found themselves a goal down after being caught out by a long ball but Jack Lorentzen-Jones soon restored parity from the penalty spot after Marcus Warren was fouled.
Lorentzen-Jones then missed a spot-kick to give the Town the lead before half-time and less than a minute into the second half the Gills restored their advantage.
But the young Hatters dug deep and levelled for a second time. Charlie Trustram’s excellent pass through the Gillingham defence saw Jamie Odegah’s shot saved, however the rebound fell to Sam Anderson who finished well.
The Hatters then got the winner their efforts deserved when Trustram tapped home unmarked at the back-post after the Gills goalkeeper had dropped the ball from a corner.
Town: Hockey, Harvey, Scott, Stitt, Emery, Kayibanda, Warren, Lorenzten-Jones, Odegah, Trustram, Anderson.
Subs: Xavier-Jones, Ioannides, Takawira, Houghton.