Loic Remy struck against the run of play after 14 minutes to take the lead, but Saints equalised through Gaston Ramirez before half-time.
Jay Bothroyd tapped the ball home from close range to restore the lead, and fine saves from substitute goalkeeper Rob Green, on for the injured Julio Cesar, helped the west London side through to a vital win.
Southampton were left to rue the fact that they did not capitalise on all their pressure on their bottom-of-the-table opponents, who lustily celebrated their first win in two months.
With so much hanging on this game, the return of Harry Redknapp to St Mary's for the first time since his ill-starred year as Saints' manager added even more spice and the QPR boss received a predictably hostile reception from some sections of the home support.
The home side ignored the day's added context to start confidently, with Adam Lallana and Jack Cork having shooting chances that did not worry Cesar in the QPR goal.
However, Rangers steeled themselves after a nervy opening spell to take the lead totally against the run of play.
Junior Hoilett's superb diagonal pass from the left allowed Remy to get in between Daniel Fox and Maya Yoshida, the striker then shooting high beyond Cesar from an angle inside the area. Fox did his best, but the ball ricocheted in off the defender's knee to give QPR a shock lead.
The goal rocked the home side, who could find little of the fluency that had put paid to Manchester City in their last home game.
They lost Lallana following a clash of heads with Clint Hill, but replacement Jay Rodriguez made his mark to restore parity before half time.
After Morgan Schneiderlin superbly robbed Hoilett in defence, Saints broke and allowed Rodriguez to get in a testing shot from distance. Cesar spilled the ball into the path of Ramirez, who delicately chipped the ball back over the advancing keeper for a sublime equaliser.
Saints looked to have carried the goal's momentum into the second half, dominating possession and going close through long range shots from Jose Fonte and Rodriguez.
Cesar required treatment for a dead leg after punching away a cross, struggling on until eventually replaced by Green, who was to make a crucial contribution in the closing stages.
QPR were back in the lead after soaking up more pressure, Ji-Sung Park staying on his feet to elude a tackle from Yoshida before pulling the ball back to Bothroyd, who had the simplest of chances to tap home from close range.
Green made his cameo appearance a memorable one with two fine saves in quick succession, flicking out his right hand to stop a powerful Yoshida header, and then dropping to his right to push Fonte's shot around the post seconds later.
With QPR holding the hosts at bay for the remainder of the match, Green's contribution was as vital as the goal scorers and Redknapp's delight at the final whistle was clear to see and may signal another unlikely act of escapology.