The home side looked to be heading four points clear at the summit after Glenn Murray converted the penalty he won for himself early on, Ciaran Clark having tangled with the forward following a corner from the right.
But, in the final ten minutes, the Magpies turned the game on its head.
Parity was restored – in bizarre fashion – thanks to Mohamed Diame following Christian Atsu’s mis-hit, before the Ghanaian squared for Perez to side-foot home to send the travelling support wild.
Rafa Benitez’s side now lead third-placed Huddersfield Town by eight points ahead of their trip to West Yorkshire on Saturday.
But, with the Amex Stadium packed to capacity, it was the Seagulls who were quickest out of the traps.
A sweetly-struck effort from skipper Bruno Saltor brought a fine save out of Karl Darlow, who did well to palm the ball clear of two attackers awaiting the follow-up.
Sam Baldock then misjudged a Saltor cross when well-placed, before Matt Ritchie was penalised for a foul on Anthony Knockaert 20 yards out.
From the resultant free-kick, Knockaert picked out Baldock, who cleverly peeled away from the wall before forcing Darlow into a low stop at his near post.
The French winger delivered the corner which followed, and – as the ball swung in – Clark was adjudged to have brought Murray to the ground six yards out.
Murray himself stepped up to take the spot-kick, and coolly sent Darlow the wrong way.
Newcastle found their feet in the following exchanges, with Ritchie’s over-hit cross almost dropping in at the back post, and Yoan Gouffran – preferred to Aleksandar Mitrovic up front – testing David Stockdale for the first time.
Brighton soon came close again, however. After Knockaert’s set-piece was only half-cleared, Murray took aim on the volley just inside the area, but Darlow was able to parry the frontman’s rasping effort.
Just before the break, United twice came agonisingly close to a leveller. First, Ritchie’s low-struck effort was saved by Stockdale at full-stretch, with Diame inches from connecting with the loose ball. DeAndre Yedlin then centred for Atsu, who brought a fine stop out of the Brighton ‘keeper with a first-time strike.
The second period began in similarly frantic fashion, albeit at the opposite end. First, Paul Dummett was forced to clear off the line after Lewis Dunk beat Darlow to a lofted ball, before the Magpies’ stopper got down to his left to deny Knockaert.
Newcastle were almost gift-wrapped a leveller on 55 minutes. Stockdale’s dreadful clearance was intercepted by Gouffran on the edge of the penalty area, but the ‘keeper recovered in time to deny the Frenchman.
It was a moment which typified the middle stages of the half, United also playing their way into trouble on more than one occasion.
With 20 minutes remaining, wide-man Jamie Murphy took aim for the Seagulls after cutting in from the left, but failed to keep his effort down.
Murphy’s namesake – Newcastle substitute Daryl – almost made an immediate impact after entering the fray, rising high to meet Ritchie’s corner, only for Stockdale to stand firm.
Ritchie and Murphy combined again with 80 minutes on the clock, but the latter’s glancing header was pushed wide by Stockdale.
However, from the resultant corner, United levelled in extraordinary fashion.
Stockdale’s punch clear dropped for Atsu just inside the area, but the winger miscued his effort completely. However, the ball took a nick off Diame, and somehow looped over the head of the Brighton stopper and into the net.
Atsu again had a vital part to play in Newcastle’s winner, which arrived with just a minute of normal time remaining.
He superbly took down Ritchie’s cross-field pass from the right, and teed up Perez – a late replacement for Gouffran – to pick out the near corner.
United came through four minutes of additional time unscathed, reclaiming their place at the top after Saturday’s draw against Bristol City.