Kilmarnock stand in the way of Dundee’s dream of a return to Scotland’s top table.
The Dark Blues booked their place in the play-off final with a 3-1 aggregate win over Raith Rovers on Saturday night.
And they waited patiently to discover who their opponents would be on the final day of the Premiership season.
Dens boss James McPake knew he would be preparing to face one of Kilmarnock, Ross County or Hamilton, though Accies required an unlikely 9-0 win to get off bottom.
There were early goals in both crucial matches and they turned things in Killie’s favour.
Going into the weekend trailing County by three points, Tommy Wright’s side knew only victory would do at Hamilton.
However, they required a bit of help from ‘Well to overhaul the Staggies.
And the afternoon got off to just the start Killie were after.
Sam Foley put Motherwell in front of Ross County after seven minutes and moments later Mitch Pinnock gave Kilmarnock their lifeline.
By half-time, Pinnock had added a second and Killie were well in control in Hamilton.
However, quickly after the break the pendulum swung back in County’s favour when captain Iain Vigurs grabbed a crucial equaliser.
And Dundonian Michael Gardyne confirmed Killie’s relegation play-off place as he put the Staggies in front at Fir Park after 66 minutes.
Pinnock would miss the chance of a hat-trick after seeing a penalty saved but Kilmarnock’s fate was out of their hands.
They now prepare to face James McPake’s Dundee at Dens Park on Thursday evening.
The second leg takes place next Monday with both legs shown live on Sky Sports.
Dundee last met Kilmarnock in February 2019 at Dens Park as they battled forlornly against the drop.
An explosive performance from striker Andrew Nelson had Jim McIntyre’s side in front twice against Killie.
However, a Chris Burke goal denied them victory and relegation would come at the end of the campaign.
Kilmarnock WDLDW GF 11 GA 8
Dundee DWWWL GF 8 GA 3