Substitute McGhee headed a late goal at Tynecastle to seal all three points.
"I'm absolutely delighted for him because he's a fantastic football player, first and foremost," Locke told BBC Radio Scotland.
"He's got a huge future ahead of him. He came on there in a difficult game and applied himself brilliantly."
It was the 17-year-old defender's first senior goal.
"He'll not have a good night tonight because he's in training tomorrow and he's too young to go into any pubs," joked Locke.
"It shows the character we've got in the squad. They're young lads who are learning quickly and you can see the desire they've got in winning games for the football club."
After Aberdeen striker Scott Vernon had missed some good early chances, Jamie Walker gave Hearts the lead when he cut in from the left to shoot past Jamie Langfield.
But the game changed when Jambos left-back Kevin McHattie was judged to have committed a professional foul on Calvin Zola in the box - McHattie shown a red card and Niall McGinn converting the penalty.
However, the 10 men of Hearts worked hard and McGhee capitalised when Dons goalkeeper Nicky Weaver missed a deep cross.
"It was an end-to-end game with two teams who were at it right from the start and tried to play good football," said Locke.
"If games are like that, it's certainly worth the admission money.
"Our influential footballers got on the ball and passed it. We want them to play and you could see a lot of good movement today."
Hearts remain on a negative points total due to entering administration earlier this year, but it is quickly being reversed after the side started the campaign with a 15-point penalty.
"It's still a huge task ahead of us," Locke added. "We're now down to minus eight which is great after four games.
"But we've got to keep our feet on the ground. We're still a million miles away from where we want to be."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.