The hosts started brightly and after Park Ji-sung charged down a Sebastian Larsson strike, Junior Hoilett shot just wide in the fourth minute.
Andros Townsend fired wide and Bobby Zamora saw penalty claims for a push by John O'Shea waved away - but it was the visitors who struck first.
Adam Johnson picked up a Stephane Sessegnon cross at the back post and sent in a fierce cross-shot, which Steven Fletcher turned home with ease from close range.
The hosts could have fallen further behind seven minutes later when Christopher Samba slipped and Danny Graham was allowed a free header on goal - but the January signing could not direct his header on goal.
QPR were level when Townsend's long-range strike fortuitously deflected off O'Shea into the path of Loic Remy, who swept home with ease from close range.
Zamora saw a flick header impressively denied by Simon Mignolet, Remy fired over, then Stephane Mbia saw a powerful drive blocked by Mignolet as the hosts finished the half on top.
Barely a minute into second half, Samba had to be alert to deny Graham before Johnson shot narrowly wide and then Clint Hill cleared a threatening Larsson cross as the Black Cats continued to press, switching to a 4-4-1-1 formation.
Danny Rose came on for Graham as Black Cats boss Martin O'Neill shuffled the pack but two impressive goals won it for the hosts.
Townsend gave QPR the lead in the 70th minute with a superb 25-yard half-volley and substitute Jermaine Jenas - an 80th-minute replacement for Remy - rubbed salt into Wearside wounds with an equally-impressive strike in the 90th minute.