Richard Langley struck late on to hand all three points to QPR
Richard Langley was the QPR hero for the second successive week, his late winner denting Cardiff's automatic promotion hopes as Rangers ran out winners.
Langley ended his 10-match goal drought last week with a hat-trick in the victory at Blackpool and his return to form strengthens Rangers' play-off hopes.
It was end-to-end action early on at Ninian Park as Robert Earnshaw and Peter Thorne failed to hit the target with headers.
Thorne went close again from Graham Kavanagh's free-kick, but saw his effort blocked by Danny Shittu.
The chances continued to flow at both ends, with Paul Furlong shooting wide from Langley's corner before Spencer Prior and Earnshaw wasted good chances for Cardiff.
The Bluebirds made a bright start to the second half and Thorne's header from a Kavanagh corner was tipped round the post by Chris Day, who then held Kavanagh's curling free-kick.
Kevin Gallen and Furlong also went close at the other end but the breakthrough finally came just after the hour from Furlong.
Gino Padula whipped in a cross from the right and the former Chelsea and Birmingham striker crashed home a header for his 11th goal of the season.
The hosts stepped up a gear after falling behind and an inspired substitution by manager Lennie Lawrence saw them draw level.
Andy Legg replaced Gary Croft and had only been on the pitch two minutes when his corner from the right picked out Thorne, who made no mistake with a bullet header.
Cardiff could have gone ahead two minutes later but Gavin Gordon was thwarted by a superb save from Day.
It was to prove costly as Langley settled matters when he converted another dangerous Padula cross after a well-worked move.
Cardiff: Margetson, Jenkins, Prior, Barker, Croft, Ainsworth,
Boland, Kavanagh, Mahon, Thorne, Earnshaw.
Subs: Legg, Bonner, Collins, Gordon, Walton.
QPR: Day, Kelly, Carlisle, Shittu, Padula, Langley, Palmer, Bircham, McLeod, Gallen, Furlong.
Subs: Culkin, Forbes, Rose, Pacquette, Thomson.
Referee: P Armstrong (Berkshire).