Grant Leadbitter's strike 14 minutes from time ensured Sunderland maintained their march towards the Premiership. Dean Whitehead put Roy Keane's Black Cats ahead after seven minutes, taking advantage of David Connolly's pass to beat Lee Camp from 14 yards.
QPR drew level in the 23rd minute, Martin Rowlands scoring from the spot after Sunderland keeper Darren Ward fouled Dexter Blackstock.
But Leadbitter fired home from 25 to seal a crucial victory for Sunderland.
Sunderland boss Roy Keane:
"I thought it was a good performance and once again the players showed great character. "They came good again and I've got great faith and trust in them. We're actually playing quite well and the players are enjoying it.
"We've been very much a team together over the past few months and I've got a great staff."
QPR boss John Gregory:
"We thought we'd done enough because Sunderland looked like they'd run out of ideas in the second half. "Roy Keane made a couple of subs which gave them a lift, but how many saves did Lee Camp have to make?
"Hopefully we just need a couple more points to be safe.
"Leeds won, but we've got two games at home and one away and if we win one of those home games then it should get us over the line."
Sunderland: Ward, Simpson, Nosworthy, Evans, Collins, Edwards, Whitehead, Yorke (Leadbitter 61), Wallace (John 46), Connolly, Murphy (Stokes 77).
Subs Not Used: Fulop, Elliott. Booked: Simpson.
Goals: Whitehead 7, Leadbitter 76.
QPR: Camp, Bignot, Cullip (Kanyuka 43), Stewart, Timoska, Bolder, Rowlands, Lomas (Idiakez 83), Moore (Furlong 69), Blackstock, Smith.
Subs Not Used: Cole, Nygaard.
Booked: Cullip, Bolder, Furlong.
Goals: Rowlands 23 pen.
Att: 39,206
Ref: M Jones (Cheshire).