The Saints squandered their chance to go third in the SPL, while Locke's side ended their run of five games without a win.
Stevenson put the hosts in front in the first half, following up to knock the ball into an empty net after Alan Mannus had denied Michael Ngoo.
Ngoo had plenty of opportunities, with a curling effort edging just wide of the post before the break and a run in the second-half that saw him pass Mannus but fail to finish and convert his pace to double the scoreline.
The on-loan Liverpool forward continued to create havoc in the closing stages, setting Sutton up to tap in Hearts' second goal and secure the win for Locke's men.
The visitors tried to find solace in the final minutes when Gregory Tade's deflected overhead kick found the net but the Saints' night was summed up as his goal was chalked off for offside.
Hearts held on to move to 10th in the SPL, six points behind sixth-placed Hibernian with three games left until the split.