Cole, who had begun his career at West Ham, had re-signed for the club on a free transfer from Liverpool in midweek, and he made an immediate impact as set up both of West Ham's goals, which were headed home by James Collins.
But Sir Alex Ferguson's side, who had taken the lead through Tom Cleverley's strike before being hit by Collins's two goals, were not to be denied as Van Persie, on as a substitute, took an exquisite cross-field ball from Ryan Giggs in his stride, before drilling the ball home past West Ham goalkeeper Jussi Jasskelainen.
A delighted Ferguson said in a TV interview: "You never rule out fighting back with our team but certainly at 2-1 down with a couple of minutes to go you hope you get a break. The manner of the goal with Ryan Giggs' ball and Robin van Persie's finish was world class."
Before Van Persie's late salvo it had looked as if it would be Cole who took centre stage.
He twice, in the 27th and the 59th minutes, curled in crosses from the left that were headed home by Collins.
The England midfielder put in a good display, showing the nice touches and clever passing that had characterised his first stint at West Ham.
Of his second debut for the club he said: "It was a nice return for me. I don't like all the fuss I just want to get out and play football and it was nice to get out, be involved and get minutes under my belt. I still feel I need a few more games, but it was nice to get out there."
He added he was optimistic West Ham still had a shot in the replay at Old Trafford to come in 10 days time.
"I felt we defended really well and we were unlucky not to win," he said.
"It feels like a missed chance, we have to go to Old Trafford and that is a tough game but we done it before."