Goals from Michael Smith and Josh Ginnelly had Robbie Neilson's side in control but a superb Charlie Adam goal reduced the deficit.
The game was all but over by half-time thanks to a Liam Boyce penalty and a stunning free-kick from recent signing Stephen Kingsley.
Danny Mullen pulled one back midway through the second half but fine strikes from Kingsley and Andy Halliday sealed an emphatic win for Hearts.