New Dundee United manager Ray McKinnon watched from the Rugby Park stand as the Tangerines beat Kilmarnock in their final match of the season.
The visitors took the lead on 12 minutes when Mark Durnan headed in a corner but Killie hit back through Kallum Higginbotham (27) and Tope Abadeyi (34).
Simon Murray then made it all square on 74 minutes with an excellent strike before grabbing a second and United’s third on 82 minutes.
Sub Harry Souttar wrapped things up with a fine header with four minutes left to secure a morale-boosting victory for the relegated Tannadice side.
United changed their keeper from the 3-3 draw against Partick Thistle on Tuesday, with Luis Zwick coming in for Eiji Kawashima, who sat on the bench.
Durnan and Coll Donaldson returned to the centre of defence, with Sean Dillon and young Souttar both listed as subs.
There was no sign of Billy Mckay and his place in attack was taken by Justin Johnson, the scorer of the injury-time equaliser against the Jags.
On five minutes, Killie threatened when Alex Henshall’s cross from the left was headed over by Obadeyi.
Three minutes later, though, the Tangerines sprung forward and Johnson’s shot from a tight angle was well saved by home goalie Jamie MacDonald.
With 12 minutes on the clock, the visitors took the lead with a simple goal.
Scott Fraser took a corner out on the left and, as the Killie defenders stood like statues, Durnan nodded down and into the net.
Some great skill from Johnson saw him wriggle into the home goalmouth just a minute later but MacDonald blocked his strike at the near post.
From the resultant corner, Durnan got in at the back post but his shot went wide, then Donaldson fired over from 15 yards as the Tannadice men enjoyed an excellent spell.
However, Killie were level on 27 minutes and it was a nightmare for captain Rankin.
A shot from 20 yards by Craig Slater seemed to catch Zwick by surprise and he parried the ball without getting any distance on his clearance.
The loose ball should have been booted clear by captain Rankin, who instead played it back to the young German only for Higginbotham to nip in and clip it past Zwick.
That was a shame for Rankin in his final match for the club and a pity for the Tangerines, who then fell behind on 34 minutes.
There was yet more sloppy defending from United and they saw their offside trap sprung by a fine pass from Higginbotham, which was converted by Obadeyi.
Matty Smith, Murray and Johnson all found room inside the Killie box after the restart but couldn’t finish.
On the hour, it should really have been game, set and match to the Ayrshire side.
Firstly, Higginbotham pulled his shot wide when it looked easier to score then Henshall broke up the left before smashing a strike against Zwick’s post.
It was United’s turn to miss a golden chance on 63 minutes when Smith sent a free header over the bar after being found by a Fraser cross.
That was the youngster’s last act of the match as he was replaced by Bradley Smith.
Donaldson stabbed the ball past Killie’s near post after a Fraser corner on 71 minutes as United tried to get back level.
They did get it back to 2-2 a couple of minutes later and it was a fine strike from Murray, who showed quick feet to make room for himself after taking a pass from Fraser.
Murray then had a shot saved from MacDonald – the Killie keeper pushing the ball around the post – then Fraser has a strike blocked as the Tangerines looked to grab a winner.
Zwick did brilliantly to save at point-blank range from Julien Faubert before Murray sent United into the lead on 82 minutes.
This time Murray did all the work himself, winning possession just inside the Killie half then racing towards the box.
He then sized up a shot and let fly from the edge of the area. MacDonald should have done better but the ball flew past him and into the net.
The Tangerines weren’t finished and, remarkably, they went 4-2 up with four minutes to go.
They had just brought on young duo Cammy Ballantyne and Souttar and the pair combined to score, with Ballantyne helping the ball on and Souttar heading into the net.
Attendance: 2,702.
Kilmarnock: MacDonald, McKenzie, Hensahll, Higginbotham (McHattie 80), Obadeyi, Ashcroft, Slater, Balatoni (Clark 67), Hodson (Faubert 70), Taylor, Frizzell. Subs not used: Brennan, Kiltie, Dicker, Whittaker.
Dundee United: Zwick, Dixon, Rankin, Ofere, Knoyle, Murray, Durnan (Souttar 83), Fraser, Donaldson, Johnson (Ballantyne 85), M. Smith (B. Smith 66). Subs not used: Kawashima, Dillon, Morris.
Referee: Bobby Madden.