A cross from Garry Brady on six minutes was mis-kicked by Neil McGowan and Stephen Robertson dived to his left to save his team-mate's blushes.
Dundee went ahead on nine minutes when young striker Bryan Deasley ran a full 50 yards with the ball at his feet, shrugging off two defenders, before firing past Robertson from 12 yards.
Stephen McDougall fired wide of the target for the visitors midway through the opening period.
Simon Lynch knocked his close-range effort agonisingly wide of the post from Robert Mann's flick on and moments later Kevin McDonald's 18-yard drive was deflected over.
A brilliant tackle by Scott Robertson stopped Bryan Prunty in his tracks as he raced through on goal on 55 minutes.
Paul Dixon's low drive went inches past a minute later.
A great save by Robertson turned Mann's point blank header away for a corner on 64 minutes.
Robertson saved again on 68 minutes, this time holding Deasley's low drive and seconds late Brian McPhee blasted his shot over for the visitors.
Dundee scored a well deserved second and secured their place in the next round when Lynch side-footed home Dixon's cross in the 73rd minute.