Dundee goalkeeper Craig Samson was the hero after he saved two spot-kicks to knock Livingston out of the CIS Cup with a 6-5 shoot-out victory.
Scott Mitchell had given Livi the lead with a 20-yard drive, but a glorious individual goal from Scott Robertson had Dundee level before half-time.
A stunning volley from Steve Craig restored the lead before Derek Lyle's decisive finish after 86 minutes.
Mitchell's 89th-minute effort struck the woodwork before the penalty drama.
Dundee: Samson, Worrell, MacKenzie, Palenik, Dixon, Daquin, Robertson, McDonald, Swankie (O'Brien 72), Davidson (Lyle 72), Zemlik (Sturm 61).
Subs Not Used: McHale, Griffin.
Goals: Robertson 33, Lyle 86 pen.
Livingston: Liberda, Mitchell, McPake, MacKay, McCaffrey, Fox, Craig (Weir 49), Kennedy, Pesir, Dorrans, Snodgrass, Weir (Griffiths 94).
Subs Not Used: Torrance, James, Stewart.
Goals: Mitchell 8, Craig 49.
Ref: C MacKay