Substitute Patrick Agyemang spared Rangers' blushes with an 84th-minute strike against the club who employed him on loan last season.
But the Championship leaders were given a tough battle by the bottom club, who matched them throughout a thrilling match.
A sensational 16th-minute strike from Jon Stead gave Bristol City hope of an upset and a second home victory in the space of three days. Danny Rose broke out of defence and found the striker, who scorned a return pass and instead cut inside onto his right foot to send a fierce shot past Paddy Kenny and in off the underside of the crossbar.
Rangers were unchanged and their manager Neil Warnock got his customary hot reception at Ashton Gate, having been involved in several controversial games here over the years. Right-back Kyle Walker was the visitors' most dangerous attacker early on, sending two efforts narrowly off target and setting up Jamie Mackie for a shot that flashed wide. It was totally against the run of play when Stead struck with his blockbuster. But Rose was starting to look lively and soon forced Kenny into a low save with a shot from a narrow angle.
There was drama at both ends at the start of the second half, Mackie forcing the ball in for Rangers only for Heidar Helguson to have been ruled offside. Seconds later Danny Haynes was through for City, but mishit his shot and found his only reward was a corner.
It took a fantastic Kenny save after 66 minutes to stop City doubling their advantage. The goalkeeper arched his back to tip over a 30-yard rocket from Marvin Elliott.
Kenny was in action again four minutes later, this time diving low to his right to keep out a well-struck shot from Stead.
Rangers hit back and Kaspers Gorkss saw a goal-bound header cleared off the line by Jamie McAllister after 72 minutes. Warnock's team got their equaliser six minutes from time following a right-wing corner with Matt Connolly's shot turned over the line from point-blank range by Agyemang.
Bristol City (4-4-2): James; Carey, Caulker, Fontaine, McAllister; Adomah (Cisse, 58), Johnson, Elliott, Rose; Haynes, Stead. Substitutes not used: Hunt, Stewart, Clarkson, Gerken, Sproule, Pitman.
QPR (4-4-1-1): Kenny; Walker, Gorkss, Connolly, Hill; Mackie, Derry, Faurlin, Ephraim (Smith, 57); Taraabt (Agyemang, 78); Helguson (Hulse, 64). Substitutes not used: Orr, Hall, Mahon, Cerny.
Referee: L Mason.Reuse content