The hosts started the brighter of the two sides, with Junior Hoilett in particular a threat down the left-hand side, yet it was Steven Fletcher who gave the visitors the lead on 20 minutes before Loic Remy levelled.
Hoilett dragged a shot wide after three minutes and then skipped away from Craig Gardner, but was unable to hit the target again.
In between chances, Bobby Zamora had a timid penalty claim turned away. The striker anticipated John O'Shea's arrival in closing him down, but referee Mike Jones was wise to Zamora's actions, although unwilling to sanction him.
Hoilett's bright opening continued as he made half a yard from the pressing Gardner and clipped the ball in behind Sunderland's defence - but the ball evaded Zamora and bounced into the arms of Simon Mignolet.
The home side's pressure was soon to be their downfall, however. After Alfred N'Diaye had dragged Sunderland's first shot at goal wide, Mignolet punched a QPR free kick toward the Frenchman. He found Fletcher, who effortlessly back-heeled the ball into the path of Stephane Sessegnon. Advancing toward the penalty area, Sessegnon patiently waited for the right time to deliver a cross, stood the ball up to the far post, where Adam Johnson was waiting and drove the ball back across goal for Fletcher to turn home.
The goal proved to be a caveat, as Rangers used the remainder of the first half to address the deficit. Stephane M'Bia fired over after Zamora had cushioned the ball down for a shot. Sunderland jabbed back as Sebastian Larsson whipped in a cross behind Chris Samba, but it bounced quickly in front of Danny Graham, who was unable to adjust and direct the ball goalwards.
QPR's next chance proved to be the leveller, as Townsend's tame-looking shot deflected wickedly off O'Shea and fell perfectly for Remy to dispatch. The in-form Frenchman flicked on Townsend's cross minutes later, but it was comfortable for Mignolet to collect.
The lively Remy then fired over after another Zamora knock-down, and M'Bia again tested the Sunderland goal from range but was dealt with at the second attempt and the half drifted towards its conclusion.
A tentative restart to the game saw Sunderland change shape - the ineffective Danny Graham was replaced by Danny Rose, with Sessegnon playing closer to Fletcher in attack.
Gardner, who again was direct with his passing from right-back, found O'Shea with a cross but the latter's flick couldn't quite release Fletcher. At the other end, Townsend again struck but was blocked, but 10 minutes later Sunderland could do nothing about his effort from outside the area which dipped away from Mignolet into the far corner.
Both sides exchanged substitutions and Adam Johnson curled an out-swinging corner out of play as the hosts' raised spirit swung the initiative in their favour. Both Remy and Hoilett - who had faded in the second half - were replaced before Jose Bosingwa's free-kick flew wide.
But there was still time for a replica of Townsend's goal, as a QPR corner was half-cleared to the feet of Jenas - who replaced Remy. The on-loan midfielder collected the ball, and himself, before firing low and beyond Mignolet to secure a vital three points.
Even then, another substitute - Jamie Mackie - was allowed to surge beyond the Sunderland back line but Mignolet did well to deny him in added time.
We'll have more match reaction coming up over the weekend and early next week in this Match Stream, so read all about it HERE.