Match ends, Bristol City 2, Queens Park Rangers 1.
Famara Diedhiou netted a late penalty to earn victory over QPR and extend Bristol City's winning run in all competitions to nine matches.
The Senegal striker converted from the spot in stoppage time after he had been brought down in the area by Darnell Furlong.
City old boy Matt Smith had put Rangers ahead just before half-time, tapping into an unguarded net after Nahki Wells headed Luke Freeman's cross against the post.
Niclas Eliasson cut inside to curl in an equaliser for the hosts, and Diedhiou kept a cool head from the spot to move City up to fifth, three points clear of seventh-placed Derby.
Smith, who scored 13 goals in 20 appearances during a loan spell with Bristol City during the 2014-15 season, came close with three headed attempts before finally getting the better of Robins goalkeeper Frank Fielding.
That was only the second league goal that Lee Johnson's team have conceded in 2019.
QPR, who almost came back from 4-0 down at home to Birmingham on Saturday, then had to withstand heavy pressure to preserve their slender lead.
However, Rangers could not hold out and Steve McClaren's side remain without a Championship victory since 26 December.
Both clubs are next in action against Premier League opposition in the FA Cup fifth round, with QPR at home to Watford on Friday and Bristol City hosting Wolves on Sunday.
City's Andreas Weimann is an early doubt to face his former club, after he was withdrawn in the first half with a back injury.
Bristol City manager Lee Johnson told BBC Radio Bristol:
"Even if we had lost that game, I was proud of the second half performance.
"I asked the players at half-time to be brave as our first-half performance wasn't good enough, I wanted the players to drive into space with the ball and create the openings.
"I haven't had to get mad too often at half-time this season, but this was one time when we weren't doing enough as individuals to take the game to the opposition.
"Every three points is vital. The boys are on a great run and it's brilliant to coach them when you get responses like that."
QPR manager Steve McClaren:
"Their penalty was ridiculous, and when the referee sees it again he will realise what a big mistake he has made.
"The foul was on Furlong, not the other way around. The fact that he took five seconds to give the penalty showed the doubt in his mind.
"We should have had at least one penalty at the other end. What the controversy shouldn't detract from is an excellent performance from ourselves.
"It is a second kick in the teeth for us after missing a late penalty, having come back against Birmingham in the last game. "I just hope my players can respond again as they did tonight because we have played really well against a team who are on a roll."
Line-ups
Bristol City
Formation 4-1-4-1
- 1Fielding
- 2PisanoBooked at 69mins
- 22Kalas
- 4Webster
- 17KellySubstituted forDasilvaat 45'minutes
- 21PackBooked at 62minsSubstituted forTaylorat 66'minutes
- 14WeimannSubstituted forEliassonat 18'minutes
- 8Brownhill
- 20Paterson
- 11O'Dowda
- 9Diedhiou
Substitutes
- 3Dasilva
- 5Wright
- 6Baker
- 10Taylor
- 19Eliasson
- 24O'Leary
- 45Palmer
QPR
Formation 3-5-2
- 13LumleyBooked at 90mins
- 2FurlongBooked at 90mins
- 37LeistnerBooked at 90mins
- 4HallSubstituted forOsayi-Samuelat 90+4'minutes
- 23WszolekBooked at 90mins
- 21LuongoBooked at 90mins
- 8Cousins
- 7Freeman
- 3BidwellBooked at 90mins
- 32WellsSubstituted forEzeat 78'minutes
- 17SmithSubstituted forHemedat 72'minutes
Substitutes
- 1Ingram
- 10Eze
- 11Scowen
- 14Manning
- 16Hemed
- 20Osayi-Samuel
- 24Kakay
- Referee:
- Tony Harrington
- Attendance:
- 19,183
Match Stats
- Possession
- Home64%
- Away36%
- Shots
- Home15
- Away11
- Shots on Target
- Home7
- Away3
- Corners
- Home8
- Away1
- Fouls
- Home12
- Away21
Live Text
Post update
Booking
Pawel Wszolek (Queens Park Rangers) is shown the yellow card for a bad foul.
Booking
Joe Lumley (Queens Park Rangers) is shown the yellow card.
Full Time
Second Half ends, Bristol City 2, Queens Park Rangers 1.
Post update
Attempt missed. Jay Dasilva (Bristol City) left footed shot from the centre of the box is high and wide to the left following a fast break.
Post update
Attempt saved. Famara Diedhiou (Bristol City) right footed shot from the centre of the box is saved in the centre of the goal. Assisted by Jay Dasilva.
Booking
Jake Bidwell (Queens Park Rangers) is shown the yellow card.
Post update
Foul by Josh Brownhill (Bristol City).
Post update
Massimo Luongo (Queens Park Rangers) wins a free kick in the defensive half.
Post update
Callum O'Dowda (Bristol City) wins a free kick on the right wing.
Post update
Foul by Luke Freeman (Queens Park Rangers).
Post update
Callum O'Dowda (Bristol City) wins a free kick on the right wing.
Post update
Foul by Toni Leistner (Queens Park Rangers).
Substitution
Substitution, Queens Park Rangers. Bright Samuel replaces Darnell Furlong.
Goal!
Goal! Bristol City 2, Queens Park Rangers 1. Famara Diedhiou (Bristol City) converts the penalty with a right footed shot to the top left corner.
Booking
Toni Leistner (Queens Park Rangers) is shown the yellow card.
Booking
Darnell Furlong (Queens Park Rangers) is shown the yellow card for a bad foul.
Booking
Grant Hall (Queens Park Rangers) is shown the yellow card.
Post update
Penalty Bristol City. Famara Diedhiou draws a foul in the penalty area.
Post update
Penalty conceded by Darnell Furlong (Queens Park Rangers) after a foul in the penalty area.