Armand Gnanduillet and Jamie Walker were on target.
Hearts moved 15 points clear at the top of the Scottish Championship after a 2-0 home win against Ayr.
Second-half goals from Armand Gnanduillet and Jamie Walker in the final 18 minutes ensured victory for the hosts, while Ayr sit above the relegation places on goal difference.
Gnanduillet saw a first-half effort deflect narrowly wide, with Andy Halliday also going close for Hearts but his header was straight at Ayr goalkeeper Viljami Sinisalo.
Liam Boyce also went close to opening the scoring for Hearts before strike-partner Gnanduillet made the breakthrough in the 72nd minute when he steered a header home from Andrew Irving's free-kick.
Substitute Walker sealed the three points when he slammed home his 51st Hearts goal in the 86th minute after Gervane Kastaneer's initial effort was blocked.