Arsenal wasted a hatful of good chances before sealing the win over Swansea thanks to midfielder Wilshere's sublime left-foot strike past Michel Vorm four minutes from time following relentless pressure from the home side.
Rooney's routine finish after nine minutes proved good enough for 11-times winners United to move into the fourth round but the England striker also missed a late penalty to make the Premier League leaders sweat in the closing stages.
Arsenal, 10-times cup winners, will travel to Championship Brighton and Hove Albion in the fourth round on the weekend of January 26-27 and United host Premier League rivals Fulham.
Wilshere, after scoring his first goal for Arsenal since November, said he was delighted with the connection he made with the ball following Olivier Giroud's superb layoff.
"I don't think I'll ever hit another one like that in my life. It was a great set up by Olivier. It's lucky I was there, we couldn't put it in," he told ESPN.
The London club's strikers Theo Walcott and Giroud both had shots blocked on the line as the home team mounted relentless attacks in a one-sided second half and Walcott's glancing header hit the post with time running out.
Swansea, who scored a late equaliser to force a replay, had the game's first good chance when former Arsenal player Kyle Bartley's header from an inswinging Wayne Routledge cross hit the bar in the 25th minute.
Arsenal defender Thomas Vermaelen forced Vorm into a smart save in the last action of the first half before the home team came out all guns blazing in the second period, to little avail until Wilshere came to the rescue.
The 21-year-old spared Arsenal's blushes with the second goal of his comeback season following 17 months out through injury.
"You can say now that Jack is completely back to his best. Credit to the people who prepared him," Arsenal manager Arsene Wenger said.
Wenger, whose side lost 2-0 at home to Swansea in the league in December, said he had never lost hope of an Arsenal win given their dominance.
"The second half was outstanding," the Frenchman said. "I felt comfortable defensively tonight because they didn't create a lot. I always had faith."
Rooney's ninth goal of the season came when he slid along the ground to guide Javier Hernandez's inch-perfect cross into the unguarded net.
Although Rooney blasted his late spot-kick over the bar, United were rarely troubled but West Ham manager Sam Allardyce was unhappy about two penalty decisions.
"We should have had a penalty. The difference is that Jordan Spence plays for West Ham and Rafael plays for Manchester United at Old Trafford. The incidents are the same. If you give one you've got to give both, simple as that," Allardyce told ITV.
United's in-form striker Robin van Persie, who did not come off the bench on Wednesday, scored a majestic equaliser in stoppage time at Upton Park to take the tie to a replay.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.