Campeonato de Portugal Division E leaders SC Farense travelled to Caldas da Rainha in the quarter-finals of the Portugal Cup and took the lead two minutes after half-time when Jorge Ribeiro crossed for Livramento to head home.
The home side Caldas SC levelled matters eight minutes later through Januário. A few minutes later, the visitors were in front again in an almost identical move as the first goal.
Jorge Ribeiro crossed again from the left and an unmarked Livramento slotted home past the helpless Luís Paulo.
Caldas responded again and made it all square after 70 minutes through Pedro Emanuel.
The heavy conditions, following torrential rain, took their toll on both teams in the final quarter of the game.
Farense were dealt a body blow when, five minutes into extra-time, Neca picked up a second yellow card. The 10 men struggled to hold the home side, eighth in Campeonato de Portugal Division D, cheered on by their local fans.
With five minutes remaining, Marcelo played in Pedro Emanuel who scored his second of the game to take Caldas into the semi-finals for the first time in their history, where they will play Primeira Liga CD Aves who beat Rio Ave 5-4 on penalties after a 4-4 draw in statutory time.