Paul Furlong rescued a point for QPR but Gillingham's survival hopes are improved after they extended their unbeaten run to seven matches.
The Gills moved out of the bottom three on goal difference even after Michael Flynn's early strike gave them a deserved lead.
Winger Flynn put in front in the 16th minute after he capitalised on a slip by Rangers defender Danny Shittu to run from the half way line, holding off two defenders, and sidefoot past Simon Royce.
Furlong almost immediately equalised when his powerful volley was tipped over the bar by Jason Brown.
And he was on hand in the 53rd minute to fire Lee Cook's cross into the corner of the net for his 18th goal of the season, before going off injured to a standing ovation.
Rangers were unlucky not to have added another just before the hour mark when Georges Santos drew Brown into a diving save.
Captain Kevin Gallen pounced on the rebound but the Gills were able to scramble the ball off the line.
Miller missed two chances either side of the break, his first from 20 yards flying high over the bar, before he headed just wide of the far post.
Cook had two early chances to put QPR ahead, the first coming seven minutes into the game when he shot inches over the bar from just inside the area.
Then he curled in a free kick towards Shittu's head, but Gills defender Ian Cox got to the ball first and headed away for a corner.
Rangers came close just before the break when Gallen was unable to keep his shot on target after good work from Santos.
Gillingham played with more purpose after their goal and looked to extend their six-match unbeaten run, but could not turn their possession into a second.
Mamady Sidibe's cross across the face of an empty net in first-half injury-time should have brought a second for Stan Ternent's side, but there was nobody available to convert it.