Tom Cleverley gave the Red Devils the lead in the 23rd minute when he slotted home, before James Collins headed an equaliser for Sam Allardyce’s men.
And Collins then gave the Hammers the lead with another header in the 59th minute.
But with just seconds remaining, substitute Van Persie ran on to Ryan Giggs’s through-ball and stroked home to earn Ferguson’s men a replay at Old Trafford.
“When you’re 2-1 down with three minutes left, you’re just hoping you get a break,” Ferguson told ITV1.
“The pass from Ryan Giggs and the first touch from Robin van Persie were absolutely world-class. Absolutely fantastic.”
“He [Van Persie] has come to a new club as a well established international. He’s a mature age now – and he’s brought that maturity to our front-line. His performance was tremendous.”
Meanwhile, midfielder Joe Cole, who re-joined his boyhood club from Liverpool on Friday, admitted his frustration at his side’s missed opportunity.
He said: “They are a quality side, they have done that countless times. They have world class players like Van Persie and Giggs.
“I felt we defended really well and we were unlucky not to win. It feels like a missed chance, we have to go to Old Trafford and that is a tough game but we done it before.”