Gillingham beat a determined 10-man Dagenham 3-2 in their FA Cup replay to reach the third round.
Hakeeb Adelakun was the last-gasp hero.
The hosts struck deep into stoppage time after the visitors had equalised. They did so late on through George Saunders.
With a home tie against 2021 FA Cup winners Leicester awaiting in the next round, both sides had chances in a hectic start.
There are only 14 places between the two teams and it was the non-league club who struck first.
Matt Robinson fired home a superb 20-yard strike in the 15th minute.
But Ipswich loanee Elkan Baggott leapt highest to level just before the half-hour mark.
Gillingham led for the first time when Max Ehmer headed home with 13 minutes left, and two minutes later Dagenham’s Harry Phipps was sent off for a studs-up challenge on Lewis Walker.
The visitors seemingly salvaged extra time when Saunders rounded Jake Turner and scored from a tight angle.
But there was late heartache when Adelakun finished off a flowing counter in the fifth minute of time added on.