Vieira has form in this competition having won the famous trophy four times with Arsenal and scoring the decisive goal in a penalty shoot-out on the last of those occasions in 2005.
And with City's £50million strikeforce of Mario Balotelli and Edin Dzeko struggling to trouble a team 59 places below them, it was left to Vieira to score with headers either side of half-time.
That gave Roberto Mancini's side the breathing space they needed, having weathered an early storm, and substitute Carlos Tevez, Dzeko and Micah Richards all scored in the final six minutes to distort the scoreline somewhat.
City now face a delayed fifth round tie at home to Aston Villa, with the winner of that game going on to face Everton or Reading in another home tie.
Despitethe scoreline there was no shame in the defeat for County who, as they did in the first meeting at Meadow Lane three weeks ago, took the attack to their more illustrious opponents.
Had they enjoyed more fortune they would have had much more to show for opening 25 minutes of domination than Karl Hawley's shot which rebounded back off the post.
From the off they attacked City and almost took advantage of an early error from Joe Hart when he flapped at deep free-kick and only the considerable frame of Yaya Toure getting in the way of Neil Bishop's shot spared the goalkeeper's blushes.
Krystian Pearce headed over the corner while Hart took no risks with Alan Gow's dipping free-kick, opting to tip it around the post.
County's best chance came midway through the first half when Hawley cut in from the left to curl a right-footed shot beyond Hart only to be denied by the far post with the ball agonisingly rolling back across the face of the goal.
But the tide began to turn just before the half-hour, starting when Nelson saved brilliantly from Dzeko's close-range header.
Aleksander Kolarov tested the goalkeeper from outside the penalty area, Dzeko failed to connect with a free header, Balotelli thought he should have had a penalty when he crashed to the floor in the area under a challenge from Craig Westcarr and Micah Richards wastefully headed over.
Balotelli also had a low shot from David Silva's cross turned behind by Nelson but even his resistance had to break some time, although City's opener was not without some luck.
David Silva's corner was met by the head of Vieira but it was the touch off Pearce which ultimately beat the County goalkeeper.
County came out after the break with renewed determination but their fire was quickly extinguished 13 minutes after the restart when Vieira met Kolarov's corner to power home his second header of the game.
But a clash of heads between Balotelli and Pearce at the set-piece ended the Italian's participation as Tevez came on to replace him.
However, before the temperamental striker, unhappy about his substitution, departed down the tunnel he directed a few words in Mancini's direction.
The visitors pressed on gamely and Gow produced a superb two-handed tip-over from Hart with his shot from range.
But their valiant fight was ended six minutes from time when Tevez outsprinted the defence to round Nelson and roll the ball into an empty net.
County undeservedly conceded two further late goals when Tevez crossed for Dzeko to head in from close range and Richards blasted home from a corner.
There was still time left for Dzeko to shoot straight at Nelson with only the goalkeeper to beat as County's defence was torn apart again.