Dundee started brightly and were awarded a penalty in the 17th minute when Scott Wilson was adjudged to have fouled Mark Burchill in the penalty area.
Steve Lovell stepped up and scored low to Marco Ruitenbeek's right.
In the 33rd minute Burchill should have made it 2-0 when a cross from Jonay Hernandez found him unmarked in front of goal but the striker failed to make proper contact and his header flew wide.
Five minutes before half time Craig Brewster went close for the visitors but saw his left-foot volley saved by Julian Speroni.
Ten minutes after half time Steve Crawford equalised for the visitors when he scored from 12 yards after being played in by Barry Nicholson.
The visitors joy was short-lived however as Dundee went in front again in the 58th minute when Lovell finished off a good move with a left-foot shot past Ruitenbeek.
Midway through the second half a great 15-yard shot by Dundee captain Barry Smith was turned around the post by the Dunfermline keeper.
Speroni kept Dundee in front with a good save to deny Craig Brewster whose free kick looked like sneaking in.
Dundee then broke quickly and Ruitenbeek denied Burchill with his foot when the striker looked like sealing the win.
The home team were made to pay for their missed chances however when Lee Bullen fired Scott McNicol's cross into the back of the net from close range in the final minute of the game to grab a point for the visitors.