Sol Bamba celebrated his new contract with a 45th minute winning goal as Cardiff City kept up a 100% record in the Championship.
Neil Warnock's current side beat his former club with a performance that warranted the win, but they almost blew it late on.
Q.P.R. took the lead when Matt Smith rose highest to head the visitors into a 15th minute lead.
Dogged determination from Ken Zohore and Junior Hoilett saw the latter get City's equaliser 7 minutes later.
Cardiff pressed and on the stroke of half time the outstanding Sol Bamba headed the winner.
The second half might not have produced any goals but for the opening 20 minutes Cardiff were brutal against the visitors and could, and should have been further ahead. Nathaniel Mendez-Laing hit the bar, Hoilett (who was also brilliant) had a very good goal ruled out and Rangers were battered.
But they held out and as the clocked ticked deep into injury time a crazy goalmouth scramble almost saw them snatch a draw.
But City held out and sit proudly on top of the table with a perfect record after five games.
What an August in the league, fan 'bloody' tastic.