QPR manager Mark Warburton was delighted with his team’s first win in eight matches but admitted they still have much to learn.
Dominic Ball’s superb injury-time strike gave Rangers a 3-2 victory after Cardiff had come back from two down to equalise.
After Yoann Barbet’s clumsy foul on Kieffer Moore, Joe Ralls tucked away the resulting penalty.
And after a handball by Conor Masterson, Ralls scored from the rebound after his second spot-kick was saved by keeper Seny Dieng.
Rangers’ display in a one-sided first half, in which Ilias Chair and Todd Kane scored, showed their potential.
“In the first half we played very well and looked a very good team,” Warburton said.
“Energy was the key for us today. We played with real intensity and purpose. We got into good areas and were dangerous.
“But it’s a 90-minute game. We’ve got to learn from the second half, where we shot ourselves in the foot by giving away ridiculous penalties.
“From a comfortable position – we should have been 3-0 up – it’s 2-2 and they’re putting balls in our box.
“When you’re in the area against good forwards you’ve got to make good decisions, and on those occasions we didn’t.”
Warburton added: “The players were angry because they felt we should have more points than we did.
“They’ve worked hard in training and showed their quality today. I think we deserved to win.
“They’re a good squad of players and when they play the game I know they’re capable of playing, we’re a good side.”
Warburton believes defender Masterson, who replaced the suspended Rob Dickie, will learn from his mistake.
“Young Conor’s a young guy learning the game,” he said.
“You learn by that and it’s good to learn and win the game – you don’t want to have that situation and have it hanging over you when you’ve lost the game.”