Glenn Murray struck in stoppage time to earn Brighton a 2-1 win at Bristol Rovers in the Carabao Cup second round.
Tom Nichols had earlier given the Sky Bet League One side hope of snatching an upset after cancelling out Aaron Connolly's opener.
However, Murray – one of 11 changes made by Graham Potter – turned in from close range in the second additional minute to spare the Seagulls' blushes.
Rovers had goalkeeper Anssi Jaakkola to thank for keeping the scores level in the 17th minute when he got down well to keep out a powerful Bernardo strike and Murray was flagged offside as he tapped in the rebound.
Jaakkola then got lucky when Brighton failed to make him pay after spilling Pascal Gross' delivery from the right into the danger area.
Adam Webster, formerly of Rovers' local rivals Bristol City and making his Brighton debut, stooped to head behind a threatening Josh Hare cross as the hosts finished the first half well.
Aaron Mooy then saw a low drive well saved by Jaakkola four minutes into the second, but the Premier League club were soon in front, with Connolly capitalising on Alireza Jahanbakhsh's deflected shot to find the net from close range.
Nichols equalised nine minutes later with a well-taken effort from the edge of the box, picking out the top-left corner to give Rovers hope.
Jaakkola got down well to keep out Murray six minutes from time, but he was unable to repeat the trick in the dying embers of the game, as the veteran centre forward scored his first of the season.