Clint Hill’s 33rd-minute goal put QPR ahead against the run of play at Loftus Road.
The veteran defender headed home Matt Phillips’ left-wing corner after Cardiff had looked more likely to open the scoring.
Rangers keeper Rob Green had produced two near-post saves, stopping shots from Scott Malone and Jose Mason.
Cardiff also threatened when Anthony Pilkington was just unable to connect at the far post with Joe Ralls’ cross.
But the Bluebirds then failed to deal with Phillips’ excellent delivery and Hill pounced to score his team’s first league goal of the season.
It lifted QPR, and Tjaronn Chery, one of their summer signings making his home debut, teed up up Matt Phillips, who fired over.
Subs: Lumley, Hall, Doughty, Kpekawa, Faurlin, Polter, Emmanuel-Thomas.