Super-sub Sam Saunders latched on to Scott Barron's left-wing cross to fire home from 10 yards, consigning Town to another Griffin Park defeat following their 2-1 league reverse on Saturday.
The breakthrough came in the 73rd minute after Saunders had replaced Harry Forrester, who was booked for a crude first-half lunge on Nathan Byrne.
Brentford should have been two up by the interval but defender Harlee Dean was denied by 'keeper Paul Jones early on before Clayton Donaldson saw his one-on-one effort tipped wide.
But the Bees had defender Tony Craig to thanks for sealing their progress, clearing former Bee Gary Alexander's effort off the line at the death.
Earlier it was all Brentford but Paul Hayes blazed over with the goal gaping before Donaldson headed over under pressure from Kyle McFadzean. Billy Clarke sent a long-range effort flashing wide for the visitors just before the break but they rarely threatened a well drilled home defence.