Dundee are relegated from the SPL as they finish one point adrift of Dunfermline at the bottom of the table.
Calum McDonald gave the Dees a 1-0 lead over Livingston while Dundee United's match at Inverness was 0-0 - and that meant Livingston faced the drop.
But eight minutes later, Livingston equalised, sending Dundee back to the bottom of the table.
Dundee United went on to beat Inverness 1-0 and Dunfermline lost 4-0 at Kilmarnock but both sides are safe.
FT Inverness CT 0-1 Dundee Utd
FT Kilmarnock 4-0 Dunfermline
FT Livingston 1-1 Dundee
1703: Full-time: Inverness 0-1 Dundee United
1701: Dundee United goalscorer Barry Robson is sent off after receiving two yellow cards.
1652: Full-time: Livingston 1-1 Dundee
DUNDEE relegated from SPL.
1650: Inverness CT 0-1 Dundee Utd
Barry Robson scores from the penalty-spot.
1648: Full-time: Kilmarnock 4-0 Dunfermline
1646: Jim Duffy's Dundee side are on the verge of relegation from the SPL and things do not look good as Livingston surge forward with just seconds of regular time left.
But seven minutes of injury-time are added because of lengthy treatment to the injured Gustave Bahoken.
1641: Dundee are throwing everything at Livingston as they try and play their way out of relegation with five minutes left on the clock.
1619: GOAL: Kilmarnock 4-0 Dunfermline
Gary McDonald is on target for Killy as Dunfermline edge closer to trouble.
If the Pars lose 6-0 and Dundee beat Livingston 2-1, Dunfermline and Livingston would have exactly the same number of points and goal difference. And both would be bottom of the table.
1610: GOAL: Kilmarnock 3-0 Dunfermline
Kris Boyd puts the home side further ahead and maybe nerves are starting to jangle among the Dunfermline supporters.
The Pars would have to concede seven goals to get drawn into the relegation battle - but they are safe for now.
1602: GOAL: Kilmarnock 2-0 Dunfermline
Rhian Dodds extends Kilmarnock's lead as he completes a simple finish from Kris Boyd's pass.
Meanwhile, the crucial match between Livingston and Dundee restarts.
1548: It is half time between Livingston and Dundee where Dundee face the drop with the scores tied at 1-1. Kilmarnock and Dunfermline's match also reaches half-time with the home side 1-0 ahead.
1528: GOAL: Kilmarnock 1-0 Dunfermline
Gary Locke heads Kilmarnock into the lead as he latches on to Peter Leven's corner.
Dunfermline are still safe despite going behind
1527: GOAL: Livingston 1-1 Dundee
Craig Easton equalises when he heads home a fine cross from Hassan Kachloul.
That means Dundee return to the bottom of the table and would go down by just a single point.
1518: GOAL: Livingston 0-1 Dundee
Calum McDonald scores his first-ever goal for Dundee to hand them a lifeline.
But it means the home side would be relegated if results remained the same.
1510: Livingston press forward against rock-bottom Dundee while at the Tulloch Caledonian Stadium the match between Inverness and Dundee United kicks off.
1500: The two matches at Almondvale and Rugby Park get under way.
1458: Kick-off at Inverness is delayed by 10 minutes because of a large number of fans travelling from Dundee.
Livingston: Craig Easton and Gustave Bahoken come in to the starting line up in place of Oscar Rubio and injured Scotland full-back David McNamee.
Dundee: Neil Barrett and Stephen McNally are promoted from last weekend's subs bench to replace Scott Robertson and Garry Brady.
Inverness: Russell Duncan and Roy McBain drop to the bench and Liam Fox and Ian Black get a start. Player-manager Craig Brewster names himself among the replacements to face his former club.
Dundee Utd: Injured defender Paul Ritchie is replaced by David McCracken, while captain Derek McInnes returns to the midfield - with Stuart Duff dropping to the bench.
Kilmarnock: Just one change, with Rhian Dodds coming in for David Lilley.
Dunfermline: Stay unchanged from the side that beat Dundee United last weekend.