Dundee kept their hopes of pipping Raith Rovers to second place alive after seeing off John McGlynn’s side at Dens Park.
First-half goals from Jason Cummings and Liam Fontaine were enough to set up a final day battle for the Championship’s runner-up spot.
Raith would get a goal back with two minutes to go through Kyle Benedictus but it was too little, too late for the Kirkcaldy outfit.
There would still be time for a late red card, however, as Dylan Tait’s late tackle capped a poor day for the visitors.
The 2-1 victory also secured James McPake’s men a place in the Premiership play-offs alongside Raith and Dunfermline.
How the match unfolded
Charlie Adam started a league match for the first time since March 16 while Paul McGowan returned after injury.
Declan McDaid missed out after picking up a hamstring injury while Danny Mullen and Jonathan Afolabi dropped to the bench. Cummings started up top.
Former Dees Kyle Benedictus and Iain Davidson started in central defence for the Kirkcaldy side at Dens Park.
The visitors started the match in confident mood after four wins in their last five league matches.
An early break from Jamie Gullan was ended unceremoniously on halfway by Lee Ashcroft, who was shown a yellow card by Willie Collum.
However, the home side got just the start they were looking for when the referee pointed to the spot on 12 minutes.
Superb work down the left from Cammy Kerr fed Cummings in the area and his shot hit Benedictus on the arm.
Collum said penalty and Cummings said thanks very much as he stepped up to stroke home from 12 yards, sending Jamie MacDonald the wrong way for 1-0.
Raith were trying to build from the back but Dundee were happy enough to let them keep it in their own half.
Any meaningful possession, though, for either side was difficult to come by on a hard pitch. That, in turn, meant chances were few and far between.
Corners, though, have been a route to goals for the Dark Blues recently and they made the most of that once more on 33 minutes.
McGowan was the man delivering and Liam Fontaine leapt highest to glance beyond the goalkeeper.
That was the defender’s fourth of the campaign and brought the goal tally for Dundee’s centre-backs into double figures.
John McGlynn’s Rovers were left searching for a route back into the match.
Midfielder Dylan Tait tried his luck from over 25 yards and sent a well-hit effort flying past the post with Adam Legzdins scrambling.
Despite some late pressure from set-pieces, it was Dundee heading in at the break with a vital two-goal lead.
Lead to defend
Dundee had the contest exactly where they wanted it, Raith having to push to get back into it and leaving gaps at the back.
The start to the second half didn’t change the flow to the game, however, with the visitors unable to get anything out of the home defence.
On 65 minutes, the Dark Blues threatened from a corner once more before the ball eventually fell to Cummings.
He went for goal from 25 yards but didn’t test MacDonald in the Raith goal.
Two minutes later Raith created their first opportunity of the afternoon.
And a big chance it was as Regan Hendry played a smart one-two with striker Gozie Ugwu.
The finish was straight at Adam Legzdins, however, with the goalie making a simple stop.
On 72 minutes, Dundee were forced into a reshuffle as goalscorer Fontaine went off with a hamstring problem.
On came Max Anderson with Jordan McGhee dropping to centre-back.
Raith were throwing everything at it and should have been on the scoresheet when sub Lewis Vaughan met Reghan Tumilty’s volleyed cross.
The attacker headed wide from six yards, however.
With minutes remaining, Dundee sent on Alex Jakubiak to make a welcome comeback after four months out with injury.
With two minutes to go, Raith were back in the game.
Dundee failed to clear a corner and allowed Hendry to fire a ball back into the area.
It deflected off Kerr and found it’s way to the back post where Benedictus headed in from a yard out.
There wasn’t time for an equaliser but there was for a straight red card.
With Dundee breaking following a corner, Tait went in hard and late on McGowan and earned his marching orders.
The home bench erupted in celebration as the referee blew for full-time, Dundee making their final day at Palmerston one with plenty to play for.
What it means
Three points for Dundee brought them to within a point of opponents Raith with just one match remaining.
The Championship’s regular season comes to a close on Friday with the Dark Blues at Queen of the South and Rovers hosting champions Hearts.
Results elsewhere saw Inverness Caley Thistle’s promotion hopes dashed with defeat at Tynecastle as Dunfermline cemented their invitation to the play-off party.
They beat Arbroath 4-3 at East End Park.
Dundee: Legzdins, Kerr, Fontaine (Anderson 72), Ashcroft, Elliott, Byrne, McGhee, Adam, McGowan, McMullan (Jakubiak 86), Cummings (Mullen 77).
Subs not used: Ferrie, Afolabi, Sow, Fisher.
Raith: J MacDonald, Tumilty, K MacDonald, Davidson, Benedictus, Hendry, Spencer, Tait, Kennedy (Vaughan 58), Ugwu (King 78), Gullan.
Subs not used: Thomson, Mendy, Armstrong, Duku, Cooney.
Referee: Willie Collum.