Trailing 1-0 to a weakened Cardiff side after Nat Jarvis' second-half opener, Barnes-Homer levelled things up for the Blue Square Premier side in the 85th minute before bagging the winner from the spot with two minutes remaining.
"People wrote Barnes-Homer off and said he wasn't going to score but I believed in him," said King.
"You have to know your players and how to nurture them and what their needs are. Matthew is an unusual character sometimes but I know how to handle him and how to get the best out of him.
"That's 20 goals he's scored now and time and time again he's dug us out. I said before the game that sometimes you won't see him and then 'bang' he'll score.
"He's not for sale and we are in the process of a new contract for him because he's earned it. He took a huge wage cut to come here so he deserves it."
Despite resting a number of senior players and making 11 changes, Championship leaders Cardiff still went into the match 81 league places above King's side.
Cardiff boss Malky Mackay said: "We picked a team here that we felt was capable of winning the game and I thought there were some fantastic performances.
"They got to five minutes to go and they just switched off and that lost us the game - but they will learn from that. I don't regret picking this team, I think they did wonderfully."
He added: "We can now get our head in the league but I want to wish Macclesfield good luck in the next round, they were fantastic."
Source: PA
Source: PA