QPR were beaten despite dominating large parts of the game.
Nahki Wells scored against his former side and Adam Nagy got Bristol City’s winner as they came from behind.
Rob Dickie’s first goal for Rangers – a header from Chris Willock’s left-wing cross – put the hosts ahead before Wells equalised totally against the run of play shortly before the break.
And Nagy’s goal five minutes into the second half took his side up to third in the Championship table.
Both teams had chances prior to Dickie’s 11th-minute goal.
The best of them fell to Nagy, who shot wide after a one-two with Chris Martin left the Hungarian through on goal.
At the other end, Lyndon Dykes was unable to get a decisive header to Ilias Chair’s right-wing cross.
Bright Osayi-Samuel, who gave Jay Dasilva a torrid time before the left-back was replaced at half-time, was denied by keeper Daniel Bentley after racing onto Yoann Barbet’s ball over the top.
But Bentley couldn’t rescue the visitors when Dickie held off City captain Tomas Kalas to nod home the opener.
Rangers then took complete control during a totally one-sided spell.
Tom Carroll’s goal-bound shot struck Nagy, who gave the ball away following the resulting corner, enabling Dickie to tee up Willock, whose shot was cleared off the line by Robins debutant Adrian Mariappa.
Chair fired narrowly wide as Rangers continued to dominate without managing to score an all-important second goal.
Having been overrun for most of the first half, the Robins levelled five minutes before the interval.
Wells, who had two loan spells with QPR, got in front of Lee Wallace to score from a yard out after Callum O’Dowda’s low cross from the left had deflected off Rangers’ Dominic Ball.
Another low left-wing cross from O’Dowda led to City going ahead.
He pounced on Dickie’s misplaced pass to Carroll and the Irishman’s ball into the box, which was aimed at Wells, ended up falling to Nagy, who coolly slotted past keeper Seny Dieng.
City then found themselves under sustained pressure again but Rangers lacked the fluency they had in the first half and Tommy Rowe, who replaced Dasilva, fared much better against the always dangerous Osayi-Samuel.
Macauley Bonne and Osayi-Samuel missed their best chances to equalise.
Substitute Bonne shot wide from near the edge of the six-yard box before Wells went close to adding a third for City when his late free-kick clipped the post.
And in stoppage time, Osayi-Samuel fired wide of the near post from close range.
QPR: Dieng; Kakay, Dickie, Barbet, Wallace (Hamalainen 74); Ball (Adomah 68), Carroll; Osayi-Samuel, Chair, Willock (Kelman 83); Dykes (Bonne 68).
Subs not used: Kelly, Masterson, Bettache, Thomas, De Silva.