Dundee kept alive their slim hopes of promotion after Jamie McCluskey struck an 88th-minute winner to hand them victory at Livingston.
Midfielder McCluskey opened the scoring in the 26th minute when he let fly from 12 yards and the ball nestled into the bottom corner.
Striker Marc McNulty levelled six minutes before half-time with a neat finish from inside the box.
Livingston took the lead two minutes after the restart when Dundee defender Neil McGregor diverted the ball into his own net after Robert Douglas had parried Stefan Scougall's volley.
Carl Finnigan equalised for Dundee after 56 minutes when he tapped in from close range.
But McCluskey sealed all three points for the visitors two minutes from time when he turned in Finnigan's header from close range.
Livingston: McNeil, Ross Docherty, Watson, Craig Barr, Cummings (Fordyce 90), Kyle Jacobs, Fox (Russell 70), Scougall, Robert Barr, McNulty, Keaghan Jacobs. Subs Not Used: Jamieson, Boulding, Downie.
Booked: Keaghan Jacobs, Craig Barr. Goals: McNulty 39, McGregor 47 og.
Dundee: Douglas, Irvine, McGregor, Weston (McKeown 67), Lockwood, McCluskey, McBride, O'Donnell, Conroy, Finnigan, Milne (Bayne 33). Subs Not Used: Gibson, Chisholm, Benedictis. Booked: Irvine, McBride, McGregor, McKeown.
Goals: McCluskey 26, Finnigan 56, McCluskey 88.
Ref: Bobby Madden