Two goals from Villa striker Andreas Weimann put the home side in control early in the second period. But Hernandez, a half-time replacement for Ashley Young, scored twice and saw his shot deflect off Villa skipper Ron Vlaar for the other United goal.
Ferguson said: "It reminded us of a cup game here a few years ago when we were 2-0 down. I think Van Nistelrooy scored a couple and we won 3-2."
He added: "We were disappointed with the first-half performance, it has to be said. You had to give credit to Aston Villa, they never gave us a minute's peace on the ball. When they got the second goal we were up against it, but once we scored our first goal, you always felt they were going to do it."
Hernandez has now netted seven times in the last five games. Ferguson said: "I've been saying it for weeks, that he's such a great professional. He doesn't complain. We do prefer that one striker with one playing behind.
"It didn't work today in the first half but when Javier came on and Robin dropped a bit deeper, and Wayne went out to the left-hand side, you had a feeling that if we got a goal we would go on and win it."
The only downside for United was an ankle knock suffered by Wayne Rooney which could place a question mark over him being fit for England's friendly with Sweden in Stockholm on Wednesday.
As regards Rooney's second-half setback, Ferguson said: "He's got an ankle knock and he has ice on it. We'll see how he is tomorrow."
Villa boss Paul Lambert had nothing but praise for his side despite United's fine comeback.
Lambert said: "I am proud. I thought they were outstanding. I couldn't ask for any more. But that's why Manchester United are a top side. They do it week in, week out. I am really proud with what they have given me. I think we have been playing well for a couple of weeks, and hopefully the confidence will be there in abundance after that."
Source: PA
Source: PA