First-half goals from Ryan Dow and Kevin Nisbet saw the Pars move to within a point of the play-offs as they ended a five-game losing run.
Dundee had the chance to move above Ayr United and into third place but James McPake's men were soundly beaten in Fife.