Dexter Blackstock ensured QPR's survival in the Championship as misfiring Cardiff finally saw their play-off bid peter out. Cardiff keeper David Forde had already denied Blackstock before the striker struck midway in the first half.
Lee Cook dashed down the right flank and whipped in a cross which Blackstock rose powerfully to head home.
Cardiff's misery was compounded when Michael Chopra was sent off after the final whistle for a tunnel incident.
The striker was shown a second yellow card for lashing out at Rangers goalkeeper Lee Camp.
QPR manager John Gregory:
"The players at QPR have been under pressure from the first game - since before I came here.
"They've constantly been trying to get out of the relegation zone and have shown unbelievable character, determination, courage and resolve.
"More than anything, a spirit in the dressing room is what has got us out of trouble."
Cardiff manager Dave Jones:
"It was a stupid thing for Michael Chopra to do, absolutely crazy. All he had to do was walk off. �
"You do battle and then you shake hands - it's a simple as that. Chops needs to grow up.
"We missed chances and that's what our season has been like since January. We have not stepped up to the plate."
QPR: Camp, Bignot, Kanyuka, Stewart, Timoska, Bolder, Rowlands (Smith 71), Lomas, Cook, Blackstock (Furlong 84), Nygaard.
Subs Not Used: Cole, Milanese, Bailey.
Booked: Bolder, Bignot, Cook.
Goals: Blackstock 23.
Cardiff: Forde, Gilbert (Parry 57), Johnson, Gunter, McNaughton, Whittingham, McPhail, Ledley, Flood (Blake 75), Thompson (Feeney 72), Chopra.
Subs Not Used: Alexander, Green.
Booked: Chopra, Gilbert, Ledley.
Att: 12,710