Well, it has been quite a day in the SPFL. Thanks to all the contributors around the grounds and to you for logging on to BBC Scotland's live football service. We'll leave you with this photo by SNS from K-Park which captures the commitment of the East Kilbride and Cowdenbeath players in the first leg of their League Two play-off final.
- Kilmarnock and Ross County now safe from relegation
- Motherwell leave Hamilton in relegation play-off spot; Caley four points adrift
- Dundee 1-1 Ross County (O'Dea; Boyce); Hamilton 0-1 Motherwell (Moult)
- Kilmarnock 2-1 ICT (Longstaff, Jones; Fisher); St Johnstone 1-0 Partick Thistle (Swanson)
- Rangers beat Hearts to seal third
- St Johnstone beat Partick to clinch fourth
- Raith relegated to League One after losing penalty shoot-out to Brechin
Interim Dundee boss Neil McCann took his unbeaten run to three - two wins and a draw - since taking over from the sacked Paul Hartley with a 1-1 draw against Ross County.
One more point may be enough, but a victory over Inverness on Wednesday would ensure their survival, and relegate Caley.
"It's a good point," he told BBC Radio Scotland. "We wanted three and want three on Wednesday. We're not there yet.
"We should've won it. For the first 20 minutes Ross County were in the ascendancy, they were the better side. We knew they would come at us. When things happen and you're tested, it shows a lot of character to come back from it.
"On the run they were on, maybe they wouldn't have come back from it. My goodness, I'm delighted with them because they did show character.
"After half an hour they started to trust their game. I felt we dominated towards the end of the first half and certainly for the next 45 minutes.
"You can see our game starting to develop. We are not a side that are prepared to be beaten."
Inverness CT manager Richie Foran: "I'm delighted with the players' performance, believe it or not. I told them they should be proud of themselves, how they handled the occasion. Individual mistakes have cost us again. The only disappointing part is the second goal. Jones has so much space to run at us. It's a set piece for us, they break and score - that's schoolboy defending but overall we were the far better team and had far better chances. We didn't get what we deserved and that was the three points, in my mind. We need to cut out the individual mistakes, it's been the story of the season. We've lost a lot of points with individual mistakes. We need a couple of results to go our way now so let's hope Ross County can do us a favour on Tuesday night (when they play 11th-placed Hamilton)."
As for who will be playing in League Two next season, Lowland League champions East Kilbride and Cowdenbeath are locked at 0-0 after the first leg of their play-off. Can Kilby reach Scottish football's fourth tier?
Alloa and Brechin will play over two legs for a place in the Championship. Both teams were in League One this season so it means promotion for one of them. Raith Rovers have been relegated.
Forfar and Peterhead will go head to head in the League One play-off final. Peterhead are trying to stay in the division whereas Forfar hope to be promoted from League Two after finishing runner-up to Arbroath.
Kilmarnock interim manager Lee McCulloch has succeeded in his mission to keep the Ayrshire club in the Premiership for another season, after their 2-1 win over Inverness at Rugby Park.
"The last 10 minutes were a bit nervy but we got there in the end," he told BBC Radio Scotland. "This is a young squad but they played tremendously well.
"We spoke at half-time about the final 15-20 minutes. We knew when we were under pressure they would be hitting it long, with the extra physicality in their team. We had to deal with that, and I thought we did it really well."
Pressed on whether he would now be made permanent manager at Rugby Park, McCulloch added: "It has got to be right for everybody involved - the club, the board, myself and the fans.
"Now we are safe, I imagine we will sit down and have a chat, but I don't know when that will be."
Andy Jackson sends the Raith Rovers keeper goalie the wrong way to win the shoot-out for Brechin City! Raith Rovers are relegated and Brechin will play Alloa for a place in the Championship next season. Incredible drama.
Scott Robertson shoots straight at the goalkeeper and Brechin have the advantage!
And he does. It's 3-3.
Declan McManus makes it 3-2 to Raith Rovers. Can Brechin respond with their fifth penalty? Ally Love has to score...
Alan Trouten scores for Brechin, it's now 2-2.
Bobby Barr's penalty is saved but Rovers still hold a 2-1 lead over Brechin in the shoot-out. Four missed penalties so far.
Raith Rovers hold a 2-1 advantage as Brechin miss another spot-kick.
Liam Watt misses his penalty for Brechin City and Raith Rovers lead 2-1 so far...
Alloa win the penalty shoot-out 4-3 against Airdrieonians! They will play Raith Rovers or Brechin City in the Championship play-off final.
Airdrieonians and Alloa are tied 3-3 on penalties so far...
Goodness me, it's penalties at Stark's Park too!
Hamilton boss Martin Canning is not a happy man after a third straight defeat leaves Accies in the relegation play-off spot, three points behind Motherwell with two games left.
"It's obviously not the result we were looking for. I thought we were the better team over the piece, and had a fantastic chance with Alex D'Acol.
"It was always going to swing on something minor. We have lost four goals from set-pieces since the split; make that five now.
"They got a a bit of luck with it hitting [Louis Moult's] shoulder and looping up over the keeper, but it is not luck that he found himself with a free header in our box.
"We are not a team that creates three, four, five, six chances in a game, and we were criminal defensively in terms of conceding from a set-piece.
"I said after the split we needed to win two out of five. It is out of our hands but now we need to win two out of two to give ourselves a chance."
Penalty kicks it is at Recreation Park!
Oh, wow! Liam Watt scores from 30 yards, only his second goal of the season, to level the match with six minutes of extra-time remaining. Unless there's another goal we are heading to penalty kicks!
Ross County manager Jim McIntyre: "We started the game in great fashion and Dundee were struggling to cope with us. I felt we got really sloppy after that, invited Dundee into the game and gave them the lift. They had their tails up. We went from being in control of the game to hanging on. We had to make changes - Ryan Dow had a clash of knees. They were controlling the match and putting us under pressure. We have come away from home and picked up a point but we were nowhere near the standards that we set in the first 25 minutes for the rest of the match. We are six matches unbeaten at this level and that's very good."
Motherwell boss Stephen Robinson is understandably a relieved man after Louis Moult's winner moves his side out of the relegation play-off spot, three points ahead of Hamilton, and means they can't be automatically relegated.
"When you lose it destroys your week and when you win, it is just relief," he tells BBC Radio Scotland.
"It was never going to be a good football match, just a pure battle, and I think we won the battle.
"Moulty was the difference between the two teams. There wasn't a lot of quality on show, but there was never going to be."
Alloa 1-0 Airdrieonians (agg 1-1)
Raith Rovers 3-2 Brechin City (agg 4-3)
Just a reminder, that Forfar and Peterhead will contest the League One play-off final after their wins over Annan and Montrose respectively. Peterhead, remember, are trying to retain their League One status.
Is Ryan Hardie's goal the one that will kill off Brechin's Championship dreams? They're still in the first period of extra-time in Kirkcaldy.
Apologies - a reboot of the PC was required there! It froze in all the excitement. Of interest to Motherwell fans is that they have avoided automatic relegation.
Kilmarnock, after their 2-1 win over Inverness, and Ross County - after a 1-1 draw at Dundee - have ensured they will be in the Premiership next season. Neither can be caught by Hamilton, who occupy the relegation play-off spot.
Inverness, now seven points adrift of Motherwell in 10th, cannot finish any higher than 11th with two games - away at Dundee, home to Motherwell - left.
Caley must get at least a point at Dundee on Wednesday, and may require a win depending on Hamilton's result at Ross County on Tuesday, to take their fight for survival to the final day of the regular season next Saturday.
So, it's extra-time at Recreation Park where Alloa and Airdrieonians finished 1-1 on aggregate after the two legs of their Championship play-off semi-final. And an added 30 minutes of football, too, at Stark's Park where Raith Rovers and Brechin City are battling it out. Declan McManus was the hero for the hosts with his late goal.
BBC Sport Scotland at Dens Park
This result will see Ross County remain in the Premiership and they'll be delighted to get over the line as they were under pressure.
Dundee are also getting there. They're inching to safety and Neil McCann will be thrilled at the response after falling behind. It took time but as the game wore on they became more and more potent.
It seems both sides will be playing Premiership football next season.
Tommy Wright has once again guided St Johnstone to European football. Danny Swanson's penalty won it against Partick and confirmed a third successive fourth-place finish for the Perth men.
Kilmarnock secure their Premiership status to thrust Inverness Caledonian Thistle deeper into relegation trouble.
Goals from Sean Longstaff and Jordan Jones put Killie in control until Alex Fisher inspired a late rally.
But Killie held on held on and cannot now be drawn into relegation play-off.
Caley Thistle stay four points adrift at the foot of the table, but now it is only Hamilton Accies who they can now overhaul as Motherwell have drawn clear of the automatic relegation spot.
Accies are lumping ball after ball into the Motherwell box, but haven't carved out any sort of opportunity. Well are content to sit back, and trust their robust defence to get them out of trouble.
East Kilbride goalie Matt McGinley saves Kyle Miller's late penalty for Cowdenbeath. What drama at EK! It remains goalless in the first leg of the League Two play-off final.
Conor Sammon rounds the Caley Thistle goalkeeper to slot home, but the Kilmarnock striker is ruled offside.
Caley Thistle breathe again and are pressing again.
Oh my, Marcus Haber should have won it for Dundee. Paul McGowan tees him up with a super swerving ball from the left, and from four yards out, the big striker heads straight into the arms of Scott Fox.
Raith Rovers are in big trouble. With only four minutes or so remaining, Brechin have edged ahead through Alan Trouten!