The visitors took the lead through Jamie Murphy’s deflected effort midway through the first half at Villa Park, before Nicklas Helenius came off the bench to restore parity with his first Villa goal 15 minutes from time.
But Flynn secured a historic win for the visitors with an unstoppable shot just five minutes later.
Despite playing down the importance of the Cup beforehand, Paul Lambert named a strong side, making just four changes from Villa's 1-0 win at Sunderland on New Year's Day.
United boss Nigel Clough, meanwhile, opted for just one alteration from the team beaten 2-1 at Walsall three days ago, with midfielder Conor Coady making way for Murphy.
The Premier League outfit started the game the brighter, but struggled to penetrate a resolute United defence, despite dominating possession.
That all changed after 20 minutes though, when a rare foray forward from the visitors saw Murphy given far too much space by the Villa defence, allowing him to cut inside from the right before drilling a superb drive from 12 yards that clipped Ciaran Clark before looping over Jed Steer and into the net.
The hosts continued to be frustrated in their attacking efforts, with shots from both Aleksander Tonev and Andreas Weimann being blocked by a crowd of bodies inside the United penalty area.
Tonev then went close again just after the half-hour mark, firing just wide from distance.
Christian Benteke had a glorious opportunity to end his barren run of 11 games without a goal just before the break, the Belgian sending a free header just wide from Marc Albrighton’s teasing cross.
The 23-year-old then wasted an almost identical chance shortly after - much to the dismay of the home faithful, who made their feelings known to Lambert and his team at half-time.
The visitors began the second period in buoyant mood, though, and were unlucky not to double their lead immediately after the break.
A mistake by Antonio Luna on the right-hand side allowed Flynn a glimpse at goal, with the 25-year old forcing Steer to turn a vicious right-footed strike round the post.
Flynn was on hand to test the keeper again just a minute later, as he drew another smart save from Steer from just outside the area as the away side began to noticeably grow in confidence.
Lambert's side struggled to cope with the tenacity of United, with Albrighton's deflected looping cross-turned-shot from 25 yards their only notable chance in the opening stages of the half.
Striker Helenius was introduced just before the hour mark, replacing the disappointing Tonev.
And the Dane looked to have spared Villa's blushes when he bundled home from close range after United failed deal with a corner from the right.
Clough’s men almost restored their advantage straight away when Jose Baxter squared to Chris Porter, who fired over from close range.
But the 5000 travelling fans were sent into dreamland five minutes later, when Flynn overpowered Fabian Delph on the edge of the box before smashing past Steer to secure United's progress to round four.