A sharp strike from Martin Rowlands fuelled QPR's flickering hopes of a return to the big time.
Rowlands' second-half goal was enough to give Ian Holloway's side three precious points and keep them in the hunt for the play-offs.
But it took a mistake from Rotherham keeper Mike Pollitt to give them a hand as they struggled to kill off the rock-bottom Millers.
Rangers frontman Paul Furlong wasted an early chance to put his side in the driving seat when he turned a first-time left-foot effort wide after Lee Cook's vicious curling cross.
Eight minutes later a mistake by Pollitt gave QPR another golden opportunity when he spilled a free-kick from Martin Rowlands, but the goalkeeper snatched the ball at the second attempt.
Rotherham midfielder John Mullin stabbed a shot wide after Simon Royce's poor punch from a long throw, before Martin McIntosh's towering header from Paul McLaren's free-kick flew over the bar.
Cook's deep testing free-kick was held by Pollitt and at the other end Paul Warne hoisted a hasty shot over from 15 yards.
But after 53 minutes Rangers pounced to grab the lead after another mistake by Rotherham keeper Pollitt.
Jamie Cureton threaded a cleverly weighted ball through for Rowlands. Pollitt tried to smother it but the ball ran free and Rowlands darted round the stranded keeper and McIntosh to slot in his shot.
Dan Shittu was within inches of adding a second but his header was fractionally wide. And when Furlong produced a powerful header Pollitt palmed it and Phil Gilchrist headed off the line.
Pollitt did well again to turn away a shot from Andrew Davies with Furlong and Dean Sturridge closing in, before a super later save denied Furlong with a blistering 30-yard free-kick.