Birmingham celebrated their 100th anniversary at St Andrews with a victory thanks to goals from Matthew Upson and Cameron Jerome.
Upson rose highest to head Gary McSheffrey's pin-point cross beyond Royce to give the Blues the lead.
Paul Furlong set up Lee Cook and the winger sent his shot arrowing into the top corner to draw the Hoops level.
But Substitute Jerome despatched McSheffrey's pass into the bottom corner from 12 yards to seal the win.
"We created enough chances to have won handsomely but failing to score that third goal always made it an anxious time.
"The determination and work-rate of the players was exceptional, while (Cameron) Jerome made a great contribution with his physical presence and pace.
"Now he has scored at home I think it will help his confidence and it will undoubtedly help his confidence."
"But this is a tough place to come to as there is a tremendous amount of strength in their side. Everyone is on the front foot at Birmingham and everyone is very positive.
"I don't think we have too many complaints and Cook's goal was outstanding. But to be fair he doesn't score enough goals for a player of his talent."
Birmingham: Maik Taylor, Kelly, Jaidi, Upson (Larsson 89), Sadler, Johnson, Nafti, Clemence, McSheffrey, Bendtner, Campbell (Jerome 59), Jerome (Muamba 90).
Subs Not Used: Doyle, Danns.
Booked: Bendtner.
Goals: Upson 22, Jerome 62.
QPR: Royce, Bignot, Mancienne, Rehman, Stewart, Milanese (Rowlands 75), Bircham (Bailey 59), Smith, Cook, Furlong, Blackstock (Ray Jones 81).
Subs Not Used: Cole, Ward.
Booked: Milanese.
Goals: Cook 31.
Att: 29,431.
Ref: K Friend (Leicestershire).