St Johnstone secured a priceless three points with this victory over Aberdeen at Pittodrie.
The win cemented fourth spot in the final Premiership table and with it the possibility of European football next season.
St Johnstone won thanks to a solitary goal from sub Chris Kane his first for the club and now all eyes will turn to next week’s Scottish Cup Final at Hampden with Saints needing Inverness to beat Falkirk to send them back on their travels to the Continent.
Saints boss Tommy Wright made just one change from the starting line-up that drew with Celtic at McDiarmid last week with Liam Caddis coming in for Gary Miller.
The game was Danny Swanson’s “swansong” for Saints with the Coventry player’s loan deal coming to an end.
The Aberdeen fans had started gathering more than an hour before kick-off, all eager to give club captain Russell Anderson a fitting send-off in what was his final game before hanging up his boots.
He led a Dons team missing a host of rested regulars such as Willo Flood, Ryan Jack, Shay Logan, Kenny McLean and Adam Rooney.
Both sides lined up before kick-off to provide Anderson with a guard of honour with the entire crowd, including the 1,277 fans from Perth, rising to give him a standing ovation.
In the seventh minute, St Johnstone had a big shout for a penalty when Swanson cut in from the left into the Dons penalty area and crashed to the turf under a challenge by Cammy Smith.
The Perth players wanted a spot-kick but referee Willie Collum was not convinced they were deserving of one and waved away their appeals.
Saints were, of course, the team with it all to play for and they certainly looked it, snapping into tackles and with crisper passing than the unfamiliar home line-up.
In the 26th minute, St Johnstone carved out an opening with Michael O’Halloran racing past the Dons defence from the right into the home penalty area but his shot from a tight angle flew into the side netting.
Saints then had a big scare in the 28th minute when they failed to clear a corner properly with the ball eventually falling for Cammy Smith but his tame shot was cleared off the line by Steven Anderson.
In the 33rd minute, St Johnstone striker Steven MacLean became the first player to be booked by Mr Collum who judged he had dived in the Aberdeen box.
The home side had another big chance three minutes later when Jonny Hayes cut in from their left past two Saints players with his shot being tipped behind for a corner by diving keeper Alan Mannus at full stretch.
The goalie was called into action again shortly after when Aberdeen broke from within their own half.
Smith stopped a St Johnstone attack and released Niall McGinn who played a pass into the overlapping Jonny Hayes but his angled shot flew straight at the keeper who saved easily.
However, in the 44th minute, Mannus had to produce a stop right out of the top drawer as Hayes struck a fierce shot from 20 yards that looked certain to nestle in the corner of the net.
Instead, the keeper somehow got a hand to the ball, deflecting it onto the post before it was cleared to safety.
The home fans and players were screaming for a penalty in the 52nd minute when Smith went down under a challenge by Tam Scobbie but the referee judged that it was a fair tackle by the defender.
Saints then went close in the 62nd minute when sub Brian Graham fired a shot just wide from 18 yards.
Wright took off MacLean in the 70th minute for Kane and it proved to be an inspired change.
Just seconds after coming on, Kane raced through onto a ball from James McFadden into the Dons penalty area and kept his cool to fire low past Brown and give Saints a precious lead.
The St Johnstone celebrations had barely died down when Mannus again had to produce another great save tipping over a spectacular Joe Shaughnessy long-range strike.
However, the Perth men held on for a famous victory with the final whistle greeted with joy from the travelling support.
Attendance 16,389.
Aberdeen Brown, Considine, Anderson, Taylor, Reynolds (Wright, 56), McGinn, Hayes, Smith (Ross, 80), Pawlett, Low (Shankland, 47), Shaughnessy.
Subs not used Langfield, Daniels, Harvie, Wright, Goodwillie.
St Johnstone Mannus, Scobbie, Anderson, Millar, Wotherspoon, Swanson, Caddis (McFadden, 56), Davidson, Easton, O’Halloran (Graham, 56), MacLean (Kane, 70).
Subs not used Banks, Lappin, Wright, Brown, Kane.
Referee Willie Collum.