Matt Smith netted a last-gasp winner as QPR beat Sheffield Wednesday 2-1 at Hillsborough in a match which saw three second-half penalties awarded.
Smith struck a fine finish three minutes into stoppage time as QPR completed a league double over the Owls in a match which had no promotion or relegation issues riding on it .
Josh Scowen had put the visitors ahead in the first half before Wednesday spurned a great chance to level when Fernando Forestieri missed from the spot just before the hour.
QPR midfielder Eberechi Eze followed suit 10 minutes from time as he saw Keiren Westwood save his penalty, before Owls defender Michael Hector showed both players how to do it by netting from 12 yards with the game's third spot-kick to make it 1-1.
However, there was to be a late twist in the tale as Smith struck right at the end to snatch the points for the visitors, who have now been victorious in the three times they have faced Wednesday on the final day of the season.
It was the hosts who looked the more threatening early on and Marco Matias twice got into good positions but could not pick out a team-mate.
QPR then saw Olamide Shodipo's header deflect off Hector before being cleared out of danger.
The home side were back on the attack again soon after when a long ball over the top sent Lucas Joao on his way. Joao played the ball through to Steven Fletcher, but he was tackled brilliantly by Rangers captain Toni Leistner.
Just before the half-hour mark, QPR took the lead.
A cross from Darnell Furlong beat the Wednesday defence and Scowen timed his run perfectly to smash the ball into the bottom left corner.
QPR came close to doubling their advantage after the break when Eze intercepted Lee on the halfway line and broke through before playing in Bright Osayi-Samuel, but he was unable to beat Westwood.
Only minutes later after that let-off, the Owls were awarded a penalty.
Forestieri was held while the ball came in and, despite the commotion from the QPR players, referee Andy Davies put the ball on the spot.
However, Forestieri stepped up and sliced his shot high and wide.
Westwood denied Smith to keep QPR just 1-0 ahead but the visitors should have strengthened their grip on the game when Osayi-Samuel was brought down by Tom Lees inside the box.
Eze stepped up with confidence but Westwood read the shot and parried it out.
Four minutes later referee Davies was pointing to the spot for a third time after Matias went down. But this time Hector made no mistake as he slotted the ball into the bottom right corner.
That looked set to earn Wednesday a draw, but deep into added time Rangers snatched a winner.
Massimo Luongo's deep cross was caught sweetly by Smith, who smashed the ball into the top-left corner.
ga('create', 'UA-72310761-1', 'auto', {'name': 'pacontentapi'});
ga('pacontentapi.set', 'referrer', location.origin);
ga('pacontentapi.set', 'dimension1', 'By Press Association Sport Staff');
ga('pacontentapi.set', 'dimension2', '3a5d595b-8bb9-41c8-9a5f-7fb1b90233f2');
ga('pacontentapi.set', 'dimension3', 'paservice:sport,paservice:sport:club-news,paservice:sport:football,paservice:sport:match-reports');
ga('pacontentapi.set', 'dimension6', 'story');
ga('pacontentapi.set', 'dimension7', 'composite');
ga('pacontentapi.set', 'dimension8', null);
ga('pacontentapi.set', 'dimension9', 'sport:football');
ga('pacontentapi.send', 'pageview', { 'location': location.href, 'page': (location.pathname + location.search + location.hash), 'title': 'Smith nets late winner as QPR beat Sheffield Wednesday'});