Play-off chasing Preston slipped to their third successive Championship defeat as 10-man QPR came from behind to win 3-1 at Deepdale.
Daniel Johnson's penalty put Preston ahead but QPR skipper Grant Hall levelled after the break, before his team-mate Geoff Cameron was given his marching orders for a second yellow card shortly after.
However, Ryan Manning struck in the closing stages and Eberechi Eze added a third before full-time to stun Deepdale.
Preston remain sixth in the table, one point above Bristol City, while QPR extended their unbeaten run to six matches.
Sean Maguire nearly handed North End the lead inside three minutes but he saw his low effort beat Rangers goalkeeper Liam Kelly and rebound off the post.
Ex-Preston striker Jordan Hugill nearly latched on to a loose backpass but Declan Rudd was quick to clear his lines.
The hosts won a penalty when Darnell Fisher was brought down by Marc Pugh and Johnson slotted into the bottom corner for his 11th strike of the league campaign as they went in front before the 20th minute.
Andrew Hughes rose highest to nod Paul Gallagher's corner wide and the midfielder nearly found Johnson with a sublime through ball which the goalscorer just missed, as the hosts impressed.
Moments after the break, Bright Osayi-Samuel blasted over the bar from the edge of the six-yard box in the visitors' best chance up to that point.
QPR had a handball plea against Ben Davies from Luke Amos' shot turned down as they sought a penalty of their own, as Ilias Chair's header missed the target.
The visitors levelled on the hour when Eze's free-kick from the right was met by Hall at the back post who made no mistake.
Preston nearly retook the lead soon after in bizarre fashion when Maguire's header from a free-kick crept over Kelly and Hall only to rebound off the bar and the striker waiting underneath.
The visitors were reduced to 10 men when Cameron was shown a second yellow card in the 67th minute for fouling Fisher, having earlier been cautioned for an offence against Gallagher.
But QPR took the lead with 12 minutes remaining when Manning produced a sublime curling finish from just inside the box to beat Rudd.
It got even better for QPR when Eze curled a right-footed 84th-minute shot past a diving Rudd to cap off the remarkable recovery.
What the managers said...
Preston's Alex Neil: "I think we started the game great. I thought we were really on the front foot. We managed obviously to get a penalty and get a goal. I thought Sean (Maguire) had a good chance first half as well which hit the post. I think that's an initial problem - we've not really capitalised on our dominance in the first half.
"I think Maguire's second-half chance is the defining minute in the game. I think if that goes in, it takes the wind out of their sails, and the likelihood is we go on and win the match. I thought we missed it and we thought 'opportunity missed' as you could see. I'm really frustrated for us, because it's an opportunity missed."
QPR's Mark Warburton: "It's a really good result, we know Preston's home record is outstanding. They're a very good team with quality and physicality, well organised by Alex of course, so we knew what we faced and in the first half, we fell into the trap. We knew that they would come out hard, put pressure on us, put balls in behind.
"We were really poor. We deserved to be one down. In truth, it was a blessing that it was only one. We didn't force a shot, didn't force a save, didn't look like created a chance, so we thoroughly deserved to be one down. We had to come out and change our shape. We made two changes - we could have made seven. It's tough on (Marc Pugh) Pughy and Dom Ball, they've been outstanding for us. We came out in the second half and you saw the result - what a reaction from the players, what a response."