Niall McGinn netted 10 minutes into each half to hand the Dons victory in Craig Brown's final home match as manager.
But Hearts had a number of first-half chances with John Sutton hitting a post and Jamie Langfield making good saves from the striker plus Jamie Walker and Michael Ngoo.
Locke said: "That was one of the positive things for us, we are creating chances, but we can't keep missing them.
"That is the story of the season for us, the chances we are getting we are not putting the ball in the net.
"That's probably the difference between the teams, Aberdeen got two chances and scored."