Brighton & Hove Albion striker Glenn Murray came off the bench to haunt former club Crystal Palace in the A23 derby.
Murray escaped suspicions of handball as he prodded home following a knock-down in Palace's penalty area to send the Seagulls into the fourth round of the FA Cup. They now face a trip to Championship side Middlesbrough.
Brighton had taken the lead through Dale Stephens midway through the first half before Bakary Sako equalised with a stunning goal in the second period.
Albion lead in first half
Palace goalkeeper Wayne Hennessey was forced into an early save, tipping over Solly March's header that had bounced awkwardly in front of goal, and Palace were happy to concede possession to their opponents in the opening stages while they retreated. Sam Baldock, an early substitute for the injured Izzy Brown, had a speculative effort from 35 yards that trickled wide.
The Eagles had their first chance when they broke away on the counter-attack, Sako forced Tim Krul into a good save before Andros Townsend worked space on the edge of the penalty area but saw his effort deflect wide for a corner.
Brighton had vast joy from set-pieces in the league fixture between the pair in November, and they could have taken the lead from one on 17 minutes had Tomer Hemed's powerful header gone either side of Hennessey rather than straight at the Welshman.
The Seagulls were the better side in the opening half an hour and deservedly took the lead through Stephens. The midfielder took advantage of plenty of space allowed to him by Palace's left side - with neither Patrick van Aanholt nor Pape Souare following his run - drove into the box and hammered his shot inside Hennessey's near post.
Roy Hodgson's side lacked impetus in attack; Sako was often isolated, bereft of support from Yohan Cabaye and James McArthur. Van Aanholt offered little movement on the left side of midfield and Brighton had Townsend nailed as the danger man. It would not be wrong to suggest Palace seriously missed Wilfried Zaha who was completely absent from the matchday squad alongside Christian Benteke. Although on the sparse occasion they did enter the final third in the first half, they created chances and had Townsend's movement been better he would have had a tap-in from Sako's inviting low cross.
Brighton had the majority of their joy down the right hand side, ironic given Palace's two left-sided players were both natural left-backs. The impressive Solly March almost guided Ezequiel Schelotto's low cross beyond Hennessey from an acute angle as the half drew to a close.
Palace youngster Sullay Kaikai replaced Townsend at half-time to join Sako up top in a 4-4-2 and the South Londoners immediately looked better balanced. Cabaye and McArthur combined on the edge of the box before Sako forced a corner. Van Aanholt then met a wonderful Jairo Riedewald pass and crossed, only for Connor Goldson to do well to beat Sako to the ball.
However, for all their attacking improvement, Palace still looked weak defensively and Martin Kelly had to block a March cross to prevent it from reaching Sam Baldock. Hennessey flapped at the resulting cross but Palace finally cleared their lines.
Brighton had an excellent chance for from their next corner, utilising their superiority at set-pieces. Palace failed to clear before Hemed swiveled and volleyed goalwards, only to have his effort deflect inches wide. Uwe Huenemeier headed over the resulting corner.
Albion paid for their missed chances soon after as Sako met a bouncing ball, was afforded too much space 25 yards from goal and fired in a powerful right-footed strike past via the post.
The goal was hardly what the visitors deserved but they almost led minutes later when the goalscorer raced clear but this time only found the side netting. Brighton responded with Baldock cracking a shot against the post before Beram Kayal fired over when he should have at least hit the target. Suddenly this fierce rivalry, which had taken a league tie and half a cup game to get going, raced into life.
Van Aanholt almost squeezed a shot under Krul from close-range before Hennessey was forced into a good save by Hemed. Baldock then raced clear but somehow fired over with the whole goal to aim at.
Brighton striker and former Palace man Murray came on to spice the tie up further, replacing Hemed for the final 10 minutes, and dramatically scored the winner with three minutes remaining.
A free-kick was once again struggled to be cleared by Palace and Murray bundled the ball home from close range as it trickled across goal. Palace players were irate, claiming Murray had handled the ball but the referee, Andre Marriner, refused to look at the Video Assistant Referee that was being used for the first time in English football.
Albion held on, despite a late scare when Sako fired across goal, and play Tony Pulis' Middlesbrough in the fourth round.