Gills captain Adam Barrett headed the hosts in front from six yards after substitute Danny Kedwell’s effort had been cleared off the goal-line by Town defender Luke Summerfield.
But on-loan Sheffield United striker Miller latched on to the end of Joe Jacobson’s pin-point delivery 11 minutes after coming on to end the visitors’ run of four consecutive league defeats.
The hosts had the better opportunities throughout and top scorer Cody McDonald hit the post shortly before half-time after rounding defender Jermaine Grandison.
McDonald almost scored a wonder goal seven minutes into the second half with an overhead kick from the edge of the box, but was denied by goalkeeper Joe Anyon.
The visitors, whose relegation to Sky Bet League Two was confirmed following last weekend’s home defeat against Peterborough , came close to scoring through Tom Bradshaw.
Dominic Iorfa played the striker through on goal after eight minutes, but his effort was well saved by Gills goalkeeper Stuart Nelson.
Connor Goldson fired over from 10 yards, Aaron Wildig struck a half-volley just wide and Jon Taylor’s cross-turned-shot was saved by Nelson before Miller struck.