Dundee made a winning start in the the first division but were made to fight all the way by the visitors.
Dundee took the lead after 11 minutes when Robert Mann headed home from close range after Adrian Madaschi's header came back off the cross bar.
The visitors equalised after 25 minutes. Stewart Kean saw his header brilliantly saved by Kelvin Jack, and after Marc Corcoran's shot was blocked on the line the ball broke to Kean again and he fired home from eight yards.
Kirk Broadfoot deserved a goal on the stroke of half time, but after waltzing past four Dundee players, his left-foot shot was turned away by Kelvin Jack.
Simon Lappin was denied by Jack when the home keeper dived full length to turn the midfielder's low shot around the post.
Simon Lynch put Dundee 2-1ahead after 76 minutes when he coolly lifted the ball over Craig Hinchcliffe after Iain Anderson's knockdown.
Seven minutes later it was 3-1 to Dundee when Scott Robertson's right-wing cross was touched to Tom McManus by Simon Lynch, and Tom McManus finished from seven yards.
Three minutes from the end substitute John Baird grabbed a second for the visitors, but Dundee held on for all three points.