The 42-year-old is leaving his job as Cowdenbeath manager to replace John Robertson, who rejoined Inverness Caledonian Thistle last month. Locke will hold the title of principal ambassador, working full-time in Hearts' commercial department and as a club ambassador on matchdays. He will also monitor players Hearts loan to other clubs alongside the club's director of football, Craig Levein.
Owner Ann Budge wanted to replace Robertson with another popular ex-player who has a good relationship with fans and sponsors, hence the approach for Locke.
He only agreed to continue with part-time Cowdenbeath at the start of June but the lure of full-time work at the club where he spent 23 years as player, coach and manager was too strong to resist. Locke has given the Central Park board his resignation and an announcement has been made confirming his new role.
It remains to be seen whether Hearts offer him an opportunity to coach within the Riccarton youth academy as Robertson did. For now, his duties will be commercial and ambassadorial.
Locke was told he was no longer wanted by Hearts when Levein arrived as director of football in June 2014. He had guided the club through a gruelling year-long administration process in his first managerial job, but after relegation Budge took control and Robbie Neilson was promoted to head coach.
Locke and his assistant Billy Brown were told they were surplus to requirements by Levein but he is now returning to the club he has supported since childhood. It is a move sure to prove popular with supporters.