Jordan Davies headed in a dramatic stoppage-time winner as Wrexham - who had led 2-0 early on - came from 5-2 down to beat Dover in an 11-goal thriller at the Racecourse Ground.
Wrexham stormed into an early lead through Paul Mullin and James Jones, but the game was turned on its head as already-relegated Dover stormed back.
George Wilkinson started the comeback with a stunning goal, which even the Wrexham fans applauded, but the home crowd were more subdued when Alfie Pavey headed in an equaliser.
Michael Gyasi then struck a hat-trick in 12 second-half minutes as the Whites stormed into a dominant lead.
Ollie Palmer scored twice to give Wrexham hope, however, and roared on by another 8,500+ crowd at the Racecourse Ground, Jordan Davies then completed a stunning comeback with two stoppage-time goals.
Mullin got the ball rolling for an unchanged Wrexham team, firing in from Luke Young's corner on six minutes.
Jones then finished low at the back post on 20 minutes to double the lead, turning in after Davies picked him out.
Wilkinson pulled one back with a stunning strike from long range just two minutes later, although Davies should have added Wrexham's third when he somehow turned onto the bar in the 25th minute.
Pavey headed in unmarked from a corner on 28 minutes, however, and the game remained level at the break.
After the interval it was Dover with their tails up though - Gyasi getting his first on 51 minutes when he raced onto a long ball and lifted it over Dibble and in.
Gyasi then tapped in at the back post to make it 4-2 on 54 minutes and he completed his hat-trick in the 63rd minute when Christian Dibble and Ben Tozer collided to allow him to tap in.
Palmer pulled one back two minutes later, turning in Jones' shot from close-range, and the big striker then fired in from the edge of the box in the 69th minute to make it 5-4.
Dover looked to take the sting out of the game, wasting time and slowing the match down to halt Wrexham's momentum.
But that led to nine minutes' stoppage time, and Davies fired a free-kick over the wall and in at the start of the additional period to equalise.
And Wrexham were not done there either - after throwing everything at the Dover goal, Davies eventually headed in at the back post to seal an incredible win.