Pools were knocked out of this year's Emirates FA Cup by Gillingham, with the visitors scoring late in normal time to level things at 2-2 and take it into extra time.
And two extra-time strikes from the visitors ensured it will be the League One side who make the trip to face Slough Town in the Second Round of the competition.
Carl Magnay and Paddy McLaughlin had put Pools 2-0 up in the first half, with the visitors pulling one back just after the re-start. The late goal for The Gills, which came from the spot, levelled things up and Pools failed to recover from the blow as the visitors went on to secure the win in extra time.
Gillingham started the game quickly, with a low effort from Tom Eaves testing Scott Loach inside the first minute but the Pools keeper was on alert and he got down well to hold it.
The visitors were brightest in the opening ten minutes but Pools soon began to press at the other end.
Ryan Donaldson had the first chance for Pools just before the quarter-hour mark when he fired in a drive from the edge of the box but he sent his effort wide. And Donaldson had the next big chance of the game, when he saw his header from close range somehow kept out by Tomas Holy in the visiting goal.
Nicky Featherstone tried his luck from 20 yards out, but watched his shot go wide, while at the other end Darren Oldaker had his shot from distance held by Loach.
Pools were looking confident by this stage, looking solid at the back while battling to get forward and with 22 minutes on the clock, Carl Magnay opened the scoring. A great freekick from Liam Noble arrived perfectly for Magnay at the far post and he made no mistake with a powerful header past Holy and into the back of the net.
Oldaker had a deflected effort put round the post by Loach as The Gills looked for a quick reply but it was Pools who next found the target.
Marcus Dinanga, who was lively this evening, fired in a good shot on goal that was only parried by Holy and Paddy McLaughlin reacted quickest as he arrived at the far post to put the ball home for his first goal for the Club.
There was a blow for Pools on 38 minutes when skipper Andrew Davies, who had been dominant for Pools this evening, went down with injury and the defender had to go off but Bates had a couple of options on the bench and Myles Anderson replaced.
Featherstone had another effort late in the half when he turned well on the edge of the area before firing a low strike through the area but it went wide and Pools went in 2-0 up at the break.
Gillingham started the half with a goal inside the first five minutes as defender Max Ehmer fired home at the far post to make for a tenser second 45 than we had hoped for.
After being the better side for much of the first half, Pools faced more of a battle in the second in a more even contest.
Luke James had a powerful strike at goal which was spilled by Holy but just as it looked set to cross the line, the keeper spun and grabbed the ball to keep it out.
With twenty minutes left, the visitors pressed for a spell, with a number of corners to test the hosts’ resolve but Pools battled well, throwing everything in the way to hold onto the lead.
A long cross in from the right picked out Tom Eaves in the centre and there was a slow wait for everyone as it made it way just over the bar at the far post.
Tyrone O’Neill broke forward at speed for Pools to push on into the box and send a shot goalwards but his effort was denied by Holy who stuck out a hand to deny the goal.
At the other end, Scott Loach reacted well to push a shot from Billy Bingham over the bar and great tracking back by Featherstone denies the visitors as the midfielder blocks well inside the box to put the ball safely into the arms of his keeper.
Magnay blocked wide a well-struck effort from Ehmer in the closing minutes as the visitors kept coming in search of an equaliser.
But Pools were served a late, late blow as a cross into the box from the right was handled by a raised blue and white shirt, with the referee pointing straight to the spot. Tom Eaves stepped up to take it and made no mistake, firing into the bottom to corner to square things up and send the tie into extra time.
Pools made a couple of decent breaks forward in the first period; the first from O'Neill down the right opened things up but his cross in to Noble was intercepted by Holy. And Conor Newton burst upfield shortly after to play in Donaldson but again the visiting keeper got in the way.
Gillingham took the lead on 102 minutes when Luke O'Neill curled a lovely freekick past the wall and into the left hand corner of Loach's net to make it 3-2 and give Pools even more work to do.
And the visitors made sure of their progress in the competition just after the re-start in the second period of added time when Elliott List fired home to make it 4-2.
Tyrone O'Neill showed real persistence to get a late goal back for Pools but it was just too late for the team to capitalise on and The Gills held on for the win.
Full Time: Pools 3 Gillingham 4
Attendance: 1873 (101 Gillingham)
Booked: Featherstone (45), Magnay (59), Loach (90)
Pools: Loach, Richardson, Davies (Anderson 38), Magnay, Kitching, Donaldson, Featherstone, Noble, McLaughlin, James (Newton 84), Dinanga (O’Neill 67).
Subs Not Used: Catterick, Kioso, Muir, Hawkes.
Gillingham: Holy, O’Neill, Ehmer, Zakuani, Hanlan (List 46), Eaves (Lacey 118), Charles-Cook (Rees 64), Fuller (Garmston 72), Bingham, Oldaker, Byrne.
Subs Not Used: Parrett, Hadler, Ogilvie.