Ross County secured a top-six place by striking late to defeat Aberdeen in the most dramatic fashion.
A draw would have suited neither side at Pittodrie, on an afternoon in which permutations constantly changed the Premiership picture.
It was Malky Mackay’s side who came out on top thanks to Joseph Hungbo’s penalty seven minutes from time.
The result marks a remarkable transformation in the Staggies’ campaign, having been bottom of the league until December.
It confirms the Dingwall side’s first top-six finish since 2016, putting them in a strong position to push for an unprecedented European place.
The Dons are left to stew over a bitterly disappointing campaign, with their supporters making their displeasure known at the full-time whistle.
It is a first bottom-half finish for the Reds since 2013. A seventh-placed target will reluctantly be the target, ahead of what is increasingly looking to be a major summer overhaul by new boss Jim Goodwin.
Both sides went into the game in need of the three points, but the equation was far from simple given the reliance on results elsewhere.
The Dons made two changes from the side which twice squandered the lead to draw 2-2 with Dundee the previous weekend. Marley Watkins was handed his first start since returning from injury, while there was also a recall for Funso Ojo, with Calvin Ramsay and Connor McLennan making way.
County also came into the game on the back of a draw, with the Staggies keeping faith with the same team which shared a 1-1 scoreline with Hearts.
There was precious little goalmouth action in the opening stages, with both sides failing to find any takers from some decent crossing positions.
It took until the 25th minute for the first attempt of any kind, which the home side should have done better with. Joe Lewis’ kick upfield picked out Watkins down the right channel, with his low delivery breaking for Vicente Besuijen to tee up Ross McCrorie, however the midfielder lashed his effort over from 12 yards.
Lewis Ferguson was next to threaten for the Dons, with a whipped free-kick which drifted wide of Ross Laidlaw’s left-hand post three minutes later.
Defences were firmly on top throughout the first half, with both sides struggling to create clear openings. Laidlaw was the first goalkeeper to be tested two minutes before the interval when David Bates met a Jonny Hayes free-kick, however it proved to be an easy save for the Staggies number one.
The Staggies nearly carved out a chance in the opening stages of the second half when Jack Baldwin nodded a free-kick towards the path of Jordan White in front of goal but he could not get the ball under control.
Baldwin’s interventions were needed defensively moments later when he got a vital touch on a Besuijen delivery to deny Christian Ramirez a strike at goal.
The Dons stepped up their threat with Ferguson curling an effort wide from a tight angle on 50 minutes after being slipped in by Watkins.
The Staggies were also beginning to show attacking threat with Jake Vokins drilling an effort over at the far post after meeting a deflected Blair Spittal cross.
Aberdeen were next to probe on 58 minutes with Hayes nodding an Ojo delivery wide, while at the other end Ferguson did well to block a dangerous Harry Paton cutback from the byline.
The Dons were able to limit the impact of the Staggies’ leading scorer Regan Charles-Cook, who came off second best in a handful of challenges throughout the afternoon.
There was huge controversy on 77 minutes when County looked to be denied a stonewall penalty, with Connor Barron appearing to clip Charles-Cook as he looked to take the ball past him, but referee Greg Aitken produced no spot-kick or booking for diving.
County needed a superb save from Laidlaw to keep them level with 10 minutes remaining, when he stooped low to claw away a Ramirez shot after the American met a McLennan delivery.
The Staggies did get their penalty on 84 minutes, with Hayes penalised for handling a Hungbo delivery from the right flank. After a delay of more than two minutes, Hungbo stepped up to send the ball straight down the middle.
Goodwin’s men rallied for a late leveller, with Besuijen sending an acrobatic effort wide. By this stage the Reds needed two goals to make any impact however, as the reality of bottom-half football dawned on the home support.
The euphoric Staggies players greeted the impressive travelling support which made the journey, however they know their season is far from over.
ABERDEEN (4-3-3) – Lewis 6; Ojo 6, Gallagher 6, Bates 6, Hayes 5; Barron 6, McCrorie 6 (MacKenzie 66), Ferguson 6; Watkins 6 (McLennan 66), Ramirez 5, Besuijen 7. Subs not used – Woods, Considine, Jenks, Polvara, Ramsay, Ruth, Milne.
ROSS COUNTY (4-2-3-1) – Laidlaw 7; Randall 7, Baldwin 8, Iacovitti 8, Vokins 6; Callachan 6, Tillson 6; Spittal 6 (Hungbo 82), H Paton 7 (Cancola 76), Charles-Cook 6 (Watson 86); White 6 (D Samuel 76). Subs not used – Munro, Watson, Burroughs, Drysdale, B Paton, MacKinnon.
Referee – Greg Aitken 6
Attendance – 15,162
Man of the match: Jack Baldwin