Pereira hit two excellent goals in a first-half where James Shea kept an opening 45 clean sheet.
His first came on 16 minutes, cutting in from the left to finish right-footed from just inside the area.
Pereira then did similar on the other side of the box shortly before half-time, beating his man on the right before rifling home left-footed to put the Town 2-0 up.
Unfortunately, a Hatters side featuring five trialists saw the Gills turn the game on its head with three goals in 20 second-half minutes, including two penalties - converted by Dominic Samuel and Robbie McKenzie - before the latter headed the winner with just over ten minutes to go.