Steffen Wohlfarth's double had County in position for victory, the German scoring either side of a Michael Ngoo header.
However, Jason Holt levelled the match 11 minutes from time and the hosts were in front 60 seconds later when Evangelos Oikonomou put through his own net. Ngoo then added a fourth in the 84th minute.
Locke was delighted with the win but encouraged his players to repeat the second half display that saw them steal all three points.
He said: "It's a great feeling. I said to the players afterwards that I want more from what I saw of them in the second half and less of what they gave me in the first.
"We tried to be more positive in the second half. I wasn't happy with what I saw in the first. We tried to go more attacking.
"Sometimes as a manager you get lucky with your substitutes. In the first half we didn't play well enough. Second half I was a lot happier.
"County will feel aggrieved that they didn't get anything out of the game and justifiably so.
"I want to reserve special praise for our goalkeeper, Jamie MacDonald. He made three outstanding saves that kept us in the game."