But the win came at a cost for Hearts who lost forward Ryan Stevenson with a serious knee injury after just 13 minutes.
Having lost to St Johnstone in their league opener last week, this was a first step in the right direction for Hearts, who began the season on minus 15 points after going into administration.
Callum Paterson got the winner with 18 minutes left and Locke said: "It's a huge, huge win.
"It did not matter who we were playing, getting the first win and putting a wee bit of pressure on the teams above us was huge, and it helps against your biggest rivals.
"The fans have been through a lot over the summer and hopefully that will be a result that keeps them happy tonight. It gives everyone at the club a lift.
"I was not too disappointed when we lost last week and I'm not going to get too carried away today.
"The sooner you get a win with the situation we're in, the better. We've done that and now we have something to build on.
"It certainly was not a classic but you saw two teams that were competitive and one bit of quality won us the game."
However, Locke is fearful that Stevenson's injury will consign him to the sidelines for some time.
"I will probably find out more on Monday, it looks a bad one," he said. "Maybe his medial ligaments.
"It looks like I'm going to lose him for a number of weeks which is a huge blow, because everybody knows we don't have the biggest of squads and he is a valuable player.
"He's getting a scan on Monday, so we'll find out more then. It's not going to be great news whatever happens but I'm hoping he's not going to be out for too long."