Liam Boyce opened the scoring just before half-time, converting the rebound after his penalty was saved, and, although the Tangerines had chances in the second period, the visitors sealed victory in the 90th minute as substitute Armand Gnanduillet fired home.
Hearts had the first clear-cut opportunity in the 19th minute when Michael Smith sent a deep cross into the are towards Craig Halkett, who headed the ball back to his centre-half partner John Souttar, but he spooned his shot well over the bar.
However, it was the Tangerines who created the best opening of the half so far in the 39th minute when Nicky Clark teed up Jamie Robson, but the full-back's angled shot was well saved by Craig Gordon.
Hearts responded immediately and should have taken the lead when Souttar produced an inch-perfect cross into the United area, but Peter Haring somehow contrived to send his header wide.
However, the travelling support were celebrating right on the stroke of half-time as their side were awarded a penalty when referee Greg Aitken decided home defender Ryan Edwards had brought down Gary Mackay-Steven in the United box.
Boyce stepped up to take the spot-kick and, although Trevor Carson made a tremendous save from his initial effort, the striker reacted quickest to smash home the rebound.
Shortly after the restart, Boyce looked to turn provider with a superb cross into the United area, but there were no one in the middle to convert.
The Tangerines' on-loan Manchester United midfielder Dylan Levitt tried his luck with a long-range effort but his shot flew straight at Gordon, who easily gathered.
Carson then had to look lively to palm away a fierce angled drive by substitute Josh Ginnelly.
In the 71st minute Gordon made a stunning stop to keep out a powerful Edwards header and came to his side's rescue again with another diving save to deny Ian Harkes.
Gordon was called in action once more as he dived full length to his right to keep out a curling 20-yard free-kick from Charlie Mulgrew.
However, Hearts finally put the game to bed right at the death as Ginnelly teed up Gnanduillet to stroke the ball home.