Gillingham’s Hakeeb Adelakun hit a 95th-minute FA Cup second-round winner as the League Two strugglers eventually overcame Dagenham and Redbridge.
He settled a classic tie and booked the Gills a third-round home encounter with 2021 winners Leicester City.
The Daggers led through Matt Robinson, before headers Elkan Baggott and Max Ehmer turned the tide.
Dagenham’s Harry Phipps was sent off but George Saunders equalized before Scott Kashket set up Adelakun’s strike.
Gillingham, second down in the fourth tier, were only saved by Kashket’s downtime equalizer in the first tie at Victoria Road 12 days earlier.
But Neil Harris’ side, who have managed just two wins and six goals in 20 league appearances this season, found it easier to score in the cups – and Adelakun’s winner was their 13th in 11 games, more than double their total in the league.
The Daggers led for 15 minutes when the Gills failed to clear their lines as Elliott Johnson’s left wing cross was hit by Josh Walker in the way of Robinson, who powered home a right-footed low shot from 20 yards.
It was dreamland for the Leicester-born Daggers skipper, who faced the prospect of meeting the 2016 Premier League winners, who won the FA Cup at Wembley just over 18 months ago.
But it took just 12 minutes for Gillingham to equalize Ben Reeves’ superb right corner when Indonesian defender Baggott outplayed and passed flat-footed visitor keeper Elliot Justham to powerfully score his third goal in six home games.
Ehmer headed home Alex MacDonald’s right wing corner for his first goal since January in the 77th minute for what looked like the winner.

And within two minutes Dagenham was reduced to 10 men when Phipps was shown a red card for an awkward high challenge on Lewis Walker.
But the non-league side wasn’t over and, when Ehmer’s weak header towards goalkeeper Jake Turner failed – Saunders clung to the open and despite being forced into the gap, slid the ball home from a tight angle.
The game looked set for extra time – and even the prospect of penalties – when substitute Kashket cleared down the left, squared off and Adelakun powered home a ferocious left-footed finish.
Who’s next?
He leaves the Gills, 23rd in League Two, with the prospect of two meetings with Premier League clubs, starting with Wolves in the League Cup on December 20 before the Leicester game in early January – but first place is Sunday’s home game with a former prime minister. League outfit, Bradford City.
Daryl McMahon’s Dagenham, 12th in the National League and four points from the play-off places, will be next in action next Tuesday when he hosts Eastleigh.
Gillingham boss Neil Harris told BBC Radio Kent:
“Cup football is all about qualifying for the next round – and now we can look forward to having Leicester live on TV here in January. And the winning goal was worthy of the reward of playing against a Premier League side .
“I’m happy for the fans. And that should give everyone confidence to score three goals in a game – but now we have to back it up on Sunday against Bradford.
“We just have to be more consistent. And, once we start doing that, we’ll start winning football games. It’s a snowball effect.
“The reason we’re so good in the cups is that you can get away with a weird mistake on 90 minutes, but you can’t do that in the league.”