The Premier League side looked set to be tumbling out of the competition after second-half goals from Alex Pearce and Aiden O'Brien put Millwall 2-0 up.
However, Jurgen Locadia gave Brighton hope of a comeback, which was duly completed when Millwall goalkeeper David Martin inexplicably let Solly March's free-kick slip through his hands with the last kick of normal time.
Shane Ferguson was sent off in extra time but Millwall held on for penalties, only to be denied a trip to Wembley as Jake Cooper blazed over to give Brighton a 5-4 win in the shoot-out and a last-four tie with Manchester City.
2 - Brighton have qualified for the FA Cup semi-final for just the second time in their history - previously doing so in 1983 when they finished as runners-up. Journey. pic.twitter.com/KXM7fSwvmt— OptaJoe (@OptaJoe) March 17, 2019
Brighton had marginally the better of a dour first half, Beram Kayal twice drawing saves from Martin, though the midfielder should have done better with a tame header from Anthony Knockaert's right-wing cross.
As a chill - and hailstones - descended over The Den, the action finally heated up. Martin dived to parry a Kayal effort from outside the box before Mat Ryan saved smartly from Jed Wallace after he was played through by Lee Gregory, who was then himself thwarted by the Australian keeper.
Millwall continued in the ascendancy, though, and were rewarded as Pearce slipped his marker Lewis Dunk and powered a thumping header into the net, despite Kayal's attempt to clear off the line.
More poor defending from Brighton enabled the home team to double their lead, Wallace breaking free down the right to square for O'Brien to find the bottom-left corner.
That looked to have settled the contest in Millwall's favour but Locadia turned and lashed home emphatically to rally Brighton, who levelled in extraordinary circumstances when Martin flapped at March's seemingly innocuous delivery.
Mahlon Romeo wasted a gilt-edged chance to restore Millwall's advantage in extra time, blazing over after Ryan could only parry James Meredith's shot into his path, and at the other end Martin was equal to March's near-post attempt at the end of a fine Brighton move.
Millwall's hopes of clinging on were dented when Ferguson deservedly saw red for stamping on Dunk, who subsequently put Brighton into a decisive lead in the shoot-out before nerves got the better of the unfortunate Cooper.
What does it mean? - Brighton keep cup dream alive
Brighton's solitary win in a domestic cup competition came in the 1910 Charity Shield. They have yet to banish the demons of their 1983 loss to Manchester United in an FA Cup final replay, but the spirit Chris Hughton's men showed in fighting back after a largely poor display proved this is a side that is determined to do so.
March makes his mark
Though there was a great deal of fortune about his goal, substitute March was influential in hauling Brighton back into the game and created their best chance to win in extra time.
A day to forget for Martin
He was not to blame for their shoot-out loss, but Millwall would be toasting a place in the last four had the experienced Martin made what appeared to be a routine catch from March's set-piece delivery.
Key Opta facts
- Brighton have won eight of their last nine penalty shoot-outs in all competitions, including each of the last three in the FA Cup.
- Millwall are unbeaten in their last six home FA Cup matches against Premier League opponents (W5 D1) - they last lost in February 2012 (Bolton Wanderers).
- Millwall's first seven goals in the FA Cup this season came from set-pieces, with O'Brien's strike their first from open play.
- Wallace has either scored or assisted in each of his four FA Cup games for Millwall at the Den (1 goal, 3 assists).
- Locadia's goal was his first in 19 away games in all competitions for Brighton, with his other five coming at home.
Both teams now switch focus back to staying in their respective leagues. Brighton host Southampton in a crucial derby at the bottom, while Millwall - just a point above the Championship's bottom three - visit promotion-chasing Leeds United.