Hearts have beaten Kilmarnock for the first time in the Premiership since 2 December 2023, a run of four games without a win.