The result gave Chris Hughton a debut win in his first game as the Seagulls manager against a resolute Brentford team.
It was heading towards a replay until Lewis Dunk headed Solly March’s cross home two minutes from time before Chris O’Grady’s hard work got the goal it deserved as he was set up by Greg Halford on the stroke of full-time.
The Bees were the architects of their own downfall, squandering a hatful of clear-cut chances in both halves. Their top scorer Andre Gray was the main culprit, heading wide on at least three occasions when well placed.
Early on it seemed only a matter of time before the hosts would take the lead, Jota mesmerising the visitors with some lovely wing play. But again there was no end product.
Alan Judge fizzed an effort just over after Brighton keeper David Stockdale had denied him minutes earlier, Gray firing the rebound well wide.
March almost gave the visitors an unlikely lead midway through the half, but was denied by a brilliantly-timed James Tarkowski tackle.
Brighton showed slightly more ambition after the break, livewire March’s angled drive rolling agonisingly wide after a fine stop by Bonham.
Brentford could have had three or four in a frantic five-minute spell just after the hour mark but for the profligacy of Gray.
First he sliced an effort wide from 12 yards and then held his head in his hands two minutes later as he saw two close-range headers bounce harmlessly wide.
The pendulum swung after that and O’Grady’s fierce shot bounced to safety off the outside of the upright as Brighton sensed a result against the run of play. It came in the dying minutes to prove that shots on target and possession statistics mean nothing in the FA Cup.
Brentford, who rested four key players, simply lacked the spark to unlock a resolute Brighton defence who rode their luck at times.
And when the chances dropped for the seasiders, they took them to leave Mark Warburton’s charges free to concentrate on their Championship promotion push.