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 .
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.