Wayne Rooney had set United on the way to avenging last season's double derby defeat to City by scoring twice in the first half against the run of play.
But United threw away its advantage when Yaya Toure scored on the hour mark and Pablo Zabaleta equalized in the 86th minute.
That was until Van Persie struck in the third minute of stoppage time, curling a free kick that was deflected by City midfielder Samir Nasri inside the far post.
"We were in control but City always come back," said Van Persie, who was pursued by City before leaving Arsenal for United in August. "It's a really special way to end this game, with the three points (won) in a really dramatic way."
In the frenzy following the goal, United defender Rio Ferdinand was hit by a coin thrown from the stands, leaving him bleeding from a cut above his left eye.
"It could have taken Rio's eye out and you've seen the cut on his head," said United winger Ashley Young, who reported seeing objects being thrown earlier at striker Wayne Rooney.
City apologized to Ferdinand and the English Football Association opened an investigation. After Ferdinand was hit, City goalkeeper Joe Hart confronted a pitch invader.
"If the pitch had not been so wet, the fan who came onto the pitch wouldn't have slipped over and could have attacked Rio," Young said. "It's not nice to see that and hopefully it'll be dealt with."
It took the gloss off United's victory that ended an unbeaten league home run for City stretching back to December 2010.
The loss made City's week even worse, with Roberto Mancini's team finishing last in its Champions League group to miss out on the knockout stage in Europe for a second successive season.
Tensions had been high from the start in the Manchester derby between the league's top two teams.
Rooney was fortunate not to be booked in the opening minutes for fouls on David Silva and Yaya Toure.
City was on top earloy with Mario Balotelli — surprisingly favoured from the start ahead of Carlos Tevez — spurning a couple of chances.
Hart's first action was to pick the ball out of his own goal when Rooney put United in front after a lightening counterattack that consisted of 10 touches in 15 seconds.
After De Gea threw the ball out, Young headed on to Robin van Persie, whose chested pass released the winger down the left flank.
Young slotted the ball through for Rooney to hit a bobbling shot through Gareth Barry's legs and into the net.
City then had a further blow as captain Vincent Kompany was forced off injured in the 21st minute, with Kolo Toure coming on.
City continued to dominate but couldn't make it count before Rooney was on target again after arriving unmarked into the penalty area.
Winger Antonio Valencia and Rafael Da Silva combined down the right flank before the defender picked out Rooney, who evaded Kolo Toure to take his derby tally to 10 goals, overtaking Bobby Charlton's United record.
Mancini was becoming increasingly anxious on the touchline, bellowing out instructions to his players while clearly unhappy at the defensive frailties.
The closest City came to reducing the deficit was Barry's strike that went wide.
When Balotelli gave the ball away after the break, Mancini immediately told Tevez to start warming up. The Argentina striker came on just seven minutes into the second half, and Balotelli stormed down the tunnel.
United had the ball in the net again in the 60th minute, but Young was ruled offside in what appeared to be an incorrect decision when he pounced on the loose ball after Van Persie had hit the post.
And City immediately went up the other end and scored.
De Gea pulled off a double save, first denying Tevez and then Aguero from the rebound. But the United defence failed to close down Tevez, who squared for Yaya Toure to score.
Silva was denied an equalizer by De Gea saving with his left shoulder, the ball then hitting the crossbar.
The equalizer came with four minutes left of regulation time. Van Persie's headed clearance from a corner went straight to Zabaleta on the edge of the area, and the Argentine drove the half-volley into the net.
"They came back, were fighting like hell. They gambled everything on the three strikers," Ferguson said.
United scored the winner after Rafael Da Silva was fouled by Tevez, setting up the free kick for Van Persie.
"What are you going to do? Are you going to shoot or cross it?" Van Persie recalled Rooney saying to him. "I said, 'I think I'll have a shot."
It was the right call, and United remains on course for a record-extending 20th English league title.