Goals from Iain Vigurs, Lionel Ainsworth, John Sutton and James McFadden secured the points for Stuart McCall's side, despite Callum Paterson scoring a consolation effort for the Edinburgh side.
It is now appears simply a matter of time before Hearts' relegation is confirmed, but Locke remains determined to take some positives from their situation.
"It's getting closer but we have said all along that until it is mathematically impossible, we've just got to keep working hard," said Locke.
"We had a disappointing day but it's important we learn from it and go again next week and try to get the three points.
"It was a difficult day. We had taken great strides in the last couple of months but this game was a step back.
"We didn't really cause them any problems whatsoever. We didn't get to grips with Ainsworth and McFadden and that proved to be our downfall."
In contrast, McCall was pleased to see his third-placed side return to winning ways after they suffered back-to-back defeats against Dundee United and St Johnstone.
"We knew we let our standards slip in the last two games. We lost six goals in the last two games and we were really sloppy in those games," he said.
"I was slightly disappointed with the goal we gave away in this game if I'm being honest but there were lots of positives.
"We have been playing well at home but this was always going to be a tricky game because Hearts have been improving.
"They can play with a bit of freedom and we were on the back of two defeats.
"I'm really pleased with the all-round effort and goals on a tricky pitch."