Raith Rovers are heading for the relegation play-offs despite producing the bravest of performances on a dramatic final day of the league season.
The Kirkcaldy men overcame a first minute red card to goalkeeper Pavol Penksa to claim a 2-1 victory over Ayr United in front of over 3000 fans at a sun-drenched Stark's Park.
However, in order to avoid the play-offs, Raith also had to rely on St Mirren losing at champions Hibernian, but a 1-1 draw at Easter Road meant the Buddies held onto their Championship status by superior goal difference, along with Dumbarton, as the three sides all finished on 39 points.
In order to keep their place in the league, Raith will now need to overcome Brechin City over two legs, starting with a trip to Glebe Park on Wednesday, before facing the winner of Alloa v Airdrie. A huge fortnight of football to come.
Raith slashed prices for the match to £5 and £2 and the decision certainly paid off as a loud home support put any previous misgivings to one side to provide one of the best vocal backings the team has received in recent years.
Every one of those fans played their part in a performance that was night and day from the previous week's shambles in Paisley.
But it wouldn't be Raith Rovers if they didn't do things the hardest way possible, and a first minute red card for Penksa ensured that would be the case.
The whole team was clearly fired up (maybe kit man Simon Pollock should do the team talk every week) but the Slovakian 'keeper was guilty of a rush of blood to the head as he came charging out of his box to clatter Ayr striker Craig Moore.
Defender Craig Barr was also on the scene, but referee Steven McLean decided the Slovakian had denied a goal-scoring opportunity and brandished the red card.
Moore was unable to continue after receiving a heavy head knock in the clash and was replaced by Declan McDaid, while Rudi Skacel was sacrificed so that Raith could replace Penksa with Connor Brennan.
Raith boss John Hughes made four changes to his starting 11, one of which was to hand young striker Jonny Court his first start for the club after impressive substitute appearances in recent weeks.
The 21-year-old grabbed his chance with both hands in an outstanding display. Not only did he get his first goal for the club, he was the catalyst for the whole performance, playing with his heart on his sleeve and constantly forcing the Ayr defence into mistakes by turning lost causes into free-kicks and corners.
Court was not alone as the whole team shrugged off the early red card to win their battles all over the park.
That got the crowd going, and the home side got the opening goal their first half deserved on 37 minutes.
Kyle Benedictus, recalled to the side after a spell on the bench, threaded a sublime pass in behind the Ayr defence which sent Court clear.
The youngster showed terrific composure to slide the ball past Greg Fleming and inside the near post to spark jubilation in the South Stand.
Raith took their lead into the half-time break, but with St Mirren holding Hibs at 0-0, as things stood, it would not be enough.
That looked like changing early in the second half as a loud roar from the home end only meant one thing ... a goal for Hibs.
There was a long delay as Ayr goalkeeper Fleming was knocked unconscious as he came to the edge of his area to try to claim a high ball.
He left the field on a stretcher and was replaced by Jordan Hart, who should have been beaten on 64 minutes when Declan McManus fired a cross to the back post and Benedictus headed wide with the goal gaping.
At the same time, news filtered across the Forth that St Mirren had equalised, and for a spell that seemed to deflate the hosts, as for the first time in the match, Ayr started to look like the side with the man advantage.
Disaster struck on 69 minutes when Raith were unable to close the space at the edge of their box and Ross Docherty drilled a low shot towards goal, that seemed to take a slight deflection as it nestled in the corner of Brennan's net.
All hope seemed lost five minutes later when Ayr were awarded a penalty when a cross struck the hand of Benedictus. It was a harsh call, given the defender was barely a yard away, and Iain Davidson was booked for his protests.
However, Brennan gave his side a lifeline as he dived to his left to parry Alan Forrest's penalty.
Raith were re-energised by the save and despite heavy legs the team refused to give up on the victory they needed, bringing Ryan Hardie off the bench for Jason Thomson and pushing men forward at every opportunity.
The goal they craved arrived in the final minute as Ross Matthews pumped a free-kick into the Ayr box, Jean-Yves M'voto won the knock-down and McManus slammed the ball past Hart from close range.
A red card, a penalty save and a last-minute winner - was the script being written for Raith's great escape?
Home fans waited for positive news from Easter Road, but it never came, and by the time the full-time whistle was blown, St Mirren had already earned the point they required to stay ahead of Rovers.
A performance such as this deserved a better outcome, but the irony is, had they produced it more often during the season, Raith would never have been in this position.
All they can do now is bring this heart and drive into the play-offs. As this season has proven, anything less won't be enough.
Raith Rovers: Penksa, Thomson (Hardie 75), Benedictus, M'voto, C.Barr, Handling, Skacel (Brennan 4), Matthews, Davidson, Court, McManus. Not used: McHattie, Johnston, Stewart, B.Barr, Thompson.
Ayr United: Fleming (Hart 58), Devlin, Balatoni, Meggatt, Boyle, McGuffie (El Alagui 45), Docherty, Gilmour, Forrest, Harkins, Moore (McDaid 4). Not used: Murphy, Cairney, Adams.
Referee: Steven McLean