Leyton Orient scraped into the second round of the FA Cup 3-1 on penalties after squandering a two-goal lead against National League South side Boreham Wood.
Sonny Perkins put the League One side ahead with a left-footed strike from the edge of the penalty area, and Daniel Agyei doubled their lead four minutes into the second half.
Tyrone Marsh pulled a goal back and Charlie O'Connell’s 85th-minute equaliser forced extra time, which Orient played most of with 10 men after Jayden Sweeney was sent off.
But The Wood, who reached the fifth round two years ago, missed three of their spot-kicks in the subsequent shootout before Ethan Galbraith converted the winning penalty.
Orient dominated the first half and should have been more than a goal up at the interval.
Agyei had an effort well saved by keeper Nathan Ashmore and Orient defender Jack Simpson volleyed wide after being set up by Dominic Ball.
The hosts were dealt another blow when captain Jack Payne went off injured shortly before half-time - and a second goal soon after the interval appeared to put the O’s in complete control.
Agyei was unable to get a decisive touch to Sweeney’s left-wing cross but made no mistake when Perkins retrieved the ball and laid it back to the striker.
However, after Jamie Donley went close to adding a third when his left-footed effort hit the bar, Boreham Wood dramatically hit back.
Femi Ilesanmi found space on the left and sent a low cross towards Marsh, who bundled the ball in from close range.
And O’Connell - who came on for Payne - headed home Tom Whelan’s corner to haul the non-league team level.
Sweeney’s dismissal for a second yellow card following a 102nd-minute foul on Whelan left his team under pressure.
But Josh Keeley produced superb saves to twice deny O’Connell in the final stages of extra time, keeping out his powerful strike and a header.
And in the shootout, Keeley saved from Whelan, while Chris Bush hit the bar and Junior Dixon fired over.
Orient’s Ollie O’Neill also saw his penalty saved, but Diallang Jaiyesimi and Darren Pratley scored with their kicks before Galbraith sealed the win.
Boreham Wood manager Luke Garrard said:
“After an hour I was already thinking about our next game on Wednesday because I felt we were out of the tie.
“I saw a sea change in our performance and it’s a shame we’re not talking about a magnificent comeback, because that can spark a season. It’s a real shame we didn’t quite make it through.
“I said to the players after 20 minutes that if you’d landed on Earth from Pluto you wouldn’t have known who was the League One side.”
Leyton Orient head coach Richie Wellens said:
“I’m relieved because the ultimate aim is to be in the draw for the second round. It’s something we need financially and also for the exposure of the club, but we should never have been in the position of going into a penalty shootout.
“We were totally dominant and in total control of the game but then we have a whacky five or six minutes and keep constantly turning the ball over.
“We kept giving the ball away and losing duels and allowed them to get into our penalty box too many times.
"It turned out to be a lot more difficult than it should have been, because we should have killed the game off.”