Dundee won to move off the foot of the First Division table and consign opponents Ayr United to the bottom spot.
Stephen O'Donnell crossed for Rhys Weston to head the visitors in front on 16 minutes.
Weston was then bundled over in the penalty area but Ayr keeper Kevin Cuthbert saved Matthew Lockwood's penalty by brilliantly diving to his left.
But the lead was doubled on 71 minutes when Leighton Mcintosh finished well from Nicholas Riley's pass.
Ayr's Mark Roberts converted his spot-kick after Lockwood's foul on Michael Moffat but Steven Milne restored Dundee's two-goal lead.
Cuthbert, Tiffoney, Malone, John Robertson, Ross Robertson, Geggan, Trouten (Wardlaw 57), McKernon (Burke 81), McGowan (Connolly 57), Moffat, Roberts. Subs Not Used: McWilliams, Armstrong.
John Robertson, McKernon, Geggan.
Roberts 83 pen.
Douglas, Irvine, Lockwood, McGregor, Weston, O'Donnell, Riley, Rae, Conroy, Milne, Mcintosh. Subs Not Used: Gibson, Chisholm, McKeown, Benedictis, McCluskey.
Weston 16, Mcintosh 71, Milne 87.