This was a must-win match for City and they did so with some style.
A goal by Christian Roberts five minutes before the break was all that separated these bidders for promotion.
Both sides now have 71 points but Rangers stay in the automatic promotion spot on goal difference and with a game in hand - a visit to Tranmere.
City boss Danny Wilson gambled on a new striking partnership of Roberts and Lee Peacock.
They worked hard against a well-organised QPR defence who went into the game with a warning of the threat from Scott Murray, newly returned to City after eight months at Reading.
As they squeezed him for room on the right openings were there on the other flank for Mickey Bell as Rangers' Marcus Bignot moved well in off the touchline.
It was fortunate for Rangers that Bell was starting for only the second time in five months.
He took time to gauge the pace and length of his crosses but when he came into the game more in the second half City had already taken their lead.
Peacock and Murray began the 40th minute move and Murray slipped through a pinpoint pass which saw Roberts go round his marker and finish strongly.
For the second half Rangers boss Ian Holloway sent on Jamie Cureton in place of Marcus Bean and later had to replace Richard Johnson who limped off just after the hour with a knee injury.
In many respects this was a good substitution for QPR as Steve Palmer played an important role as his side wrested control of the midfield.
City had a marvellous chance to wrap up the points on 72 minutes when Luke Wilkshire sent Murray away on an electric run through the middle.
Lee Camp, the 19-year-old keeper on loan from Derby, came out to block Murray's shot and then Palmer cleared giving away a corner as the ball rolled towards the open net.
In the home goal, Steve Phillips had a quiet time but made an alert save with five minutes to go to deny Rangers a point.
A long dribble by Paul Furlong down the left saw the ball played into the feet of substitute Tony Thorpe. The former City striker looked certain to score but Phillips flung himself down to block the shot.