Walker's clumsy challenge on John Baird allowed Aaron Muirhead to lash home a well-deserved 85th-minute opener that looked set to send the Jags top of the Scottish Premiership table.
But the midfielder burst forward three minutes later to smash the ball into the top corner from 20 yards to earn Hearts a 1-1 draw and move them to within 11 points of their nearest challengers following their punishment for going into administration.
Locke said: "Fair play to Jamie. He switched off a bit at the corner and got caught wrong side and gave away the penalty
"But he kept his head up and he's come up with a wonderful strike to get us back in the game.
"I'm delighted with that, it was just the 30 seconds of concentration that cost us.
"But we are learning all the time. We are a young team and we are going to make mistakes.
"It's important we respond in the right manner and we did that."
Locke, who had six players involved in Scotland Under-21s' 6-0 defeat by England on Tuesday, added: "The players showed unbelievable character again and showed they are fighting for the cause. It was certainly a goal worthy of an equaliser.
"The spirit's there. It's been a difficult week. We have not had much time on the training ground with half the boys being away.
"Preparation wasn't great but they showed they are willing to battle right to the end."
- Sports & Recreation
- Aaron Muirhead
- Scottish Premiership