The hosts went in front in the southern section second-round tie at London Road when Bees goalkeeper David Button parried Paul Taylor's shot against the legs of defender Martin Taylor, who was powerless to prevent it ricocheting into the net.
Button did rather better with a couple of further Taylor efforts as Posh had to wait until 20 minutes from time to double their advantage - Nathaniel Mendez-Laing making an immediate impact seconds after his introduction.
Former Wolves flyer Mendez-Laing saw his burst into the penalty area curtailed by Bees skipper Tony Craig's poor challenge and Grant McCann did the honours from the spot, cheekily clipping his penalty past Button.
But Brentford rallied in a bid to avoid an early exit and Ben Nugent headed home a cross from former Posh player Toumani Diagouraga to halve their arrears.
Nugent then steered another header wide before Bobby Olejnik denied George Saville and Marcello Trotta to ensure Posh advanced.