Both teams grabbed a goal in first half injury time, before Coree Wilson put the Town in the lead with a close-range effort just after the hour mark, with Connor Tomlinson rounding off the scoring late on.
Harry Isted was forced into two fantastic saves early on as he got down quickly to keep out Aaron King's low drive, before the keeper tipped Alfie Powell's back stick header over.
King proved to be a problem for the Hatters for most of the evening and opened the scoring as he worked his way into the box before slotting past Isted and into the bottom right corner.
With half-time looming, Jake Peck got the visitors back on level terms when he was tripped on the edge of the box. He took the resulting free-kick, bending it over the wall and into the bottom left corner in exquisite fashion.
Wilson was introduced just after the hour mark in the place of Josh Kalonda and netted just minutes later as Drew Richardson slipped the ball down the right for Tomlinson to pick out the run of Wilson, and the midfielder made no mistake as he passed it into the back of the net from close range.
The hosts very nearly pulled it level with four minutes of normal time to play when Isted got down quickly to keep out Sam Johnson's effort from just inside the box, before King glanced wide from an in-swinging corner.
Town killed off the game with a goal in the first minute of injury time, as Josh Neufville cut in from the left, teed up Tomlinson and he managed to get it over the line at the second attempt from a couple of yards out.
The result means the Hatters will play away at Arlesey Town in the second round of the competition.
The Town team: Isted ©, Jones, Panter, Byron, Wilson-Braithwaite (Moloney 33), Beckwith, Richardson, Peck, Tomlinson, Neufville, Kalonda (Wilson 61).
Subs not used: Holden, Boorn.
Goals: Peck 45+3, Wilson 64, Tomlinson 90+1
Yellows: Peck, Richardson