Charlie Taylor's injury-time header ensured League Two Barnet overcame Blue Square Bet Premier Southport to reach the FA Cup second round.
Clovis Kamdjo met Mark Byrne's cross to nod the Bees in front after the break.
The Sandgrounders, who had gone nine games unbeaten, levelled when Steve Akrigg headed home.
Taylor rescued struggling Barnet from facing a replay at Underhill when he met Sam Deering's cross to secure a dramatic winner.
VIEWS FROM THE DRESSING ROOM
Southport manager Liam Watson told BBC Radio Merseyside:
"Football can be cruel at times but we'll just have to accept it.
"If I'm honest, Barnet have probably decided to take us back to Underhill and we thought that as well. I didn't see a goal coming for either side.
"Our aim now is to stay where we are in the play-offs and the FA Trophy becomes a live thing for us and we've got to give everything we've got."
Barnet boss Lawrie Sanchez told BBC London 94.9:
"It was a very difficult game here against a very good Southport team that are doing very well in the Conference.
"We defended manfully today. They threw a lot at us from corners and free-kicks and the defence did very well against that.
"I'm pleased for the players. We've had a great week, probably the best week's work since I've been here."