Mark Hughes' visitors had made a mockery of their paltry goalscoring record so far this season by taking a third-minute lead through Peter Crouch and going straight back in front through a Marko Arnautovic free-kick after Robin van Persie had equalised for the home side.
But Moyes' substitutions paid off with Hernandez providing the inspiration for United when he headed home Patrice Evra's cross just two minutes after Rooney had flicked his side back level.
Moyes said: "I thought with 15 to 20 minutes to go the supporters were terrific - they drove the team on and they played a big part in getting the result.
"I thought in the end we had to go for it. I thought we did a lot of good things but an awful lot of really poor things that put us in the situation we were in.
"We got ourselves back in the game just before half-time only to concede from a poor, poor free-kick.
"That got us going in at half-time on a downer but I said at half-time your job is to win the game and you're more than capable of doing it. We needed the substitutes today and they made a big difference."
For breaking stories and all the great banter like us on Facebook: facebook.com/tribalfootball