Dundee 0 Livingston 1
Ex-Dundee player Steven Craig had a great chance for the visitors midway through the first half, but Calum Reidford saved his point-blank effort.
Graham Dorrans found space in the Dundee box and got on the end of Jason Thomson's cross, but his attempted header goalwards was shocking and went back in the same direction as the cross 10 minutes before half time.
Alex Rae's low shot from distance was saved by Stewart before James McPake headed wide for Livingston.
Dorrans went close early in the second half, his 18-yard shot flying just over.
Swankie was unlucky not to get a touch on Paul Dixon's cross when he threw himself full length towards the ball in the danger area midway through the second half.
There were claims for a penalty from the visitors after 78 minutes when Gary McKenzie dived full length to block Mackay's goal-bound effort, but the referee said it came off his chest.
Livingston went ahead in the 79th minute when McKenzie's clearance cannoned off the leg of Dave Mackay and flew into the back of the net.
Despite the home team's efforts, their best chance fell to centre half McKenzie in the final minute as the young defender failed to get a ball out from under his feet and the danger was cleared.