In an excellent cup tie, the visitors started strongly but it was the Mariners who broke the deadlock when Ross Hannah scored on 25 minutes.
Huddersfield hit back with a superb free kick by Oliver Norwood early in the second half but Craig Disley restored Grimsby’s advantage shortly after the hour.
Town had been the better side for long periods and gave their all throughout the game but their dreams of a first fourth round appearance in 15 years took a knock when Martin Paterson equalised.
And that dream was shattered in the last minute, when an Aswad Thomas own goal settled the tie in the away side’s favour.
Just one change was made to the Town side for the visit of the Terriers, with Andy Cook coming into the XI in place of the suspended Lenell John-Lewis.
Otherwise, it was the team that drew 1-1 with Lincoln City last time out, with James McKeown lining up in goal behind a defence of Paul Bignot, Shaun Pearson, Chris Doig and Thomas.
Joe Colbeck, Disley, Andi Thanoj and Scott Neilson were the midfielders, with Cook joined by Hannah in attack.
Sam Hatton had recovered sufficiently to take a place on the seven-man substitutes’ bench, where Jonathan Hedge, Dayle Southwell, Ellis Humble, Alex Rodman, Caine Winfarrah and Paddy McLaughlin were also selected.
Huddersfield made the trip along the M62 looking to avoid what would statistically be the biggest shock of the round and make the three-division gap between them and the Mariners count.
Mark Robins’ side included former Town loanee and crowd favourite Paterson, who would be looking to score the goals to fire the West Yorkshire club into round four.
Huddersfield had the first chance of the game in the opening minute and McKeown was forced to dive and keep out a header from Tommy Smith, at the expense of a corner.
Hannah almost had an opportunity for Grimsby when a long kick by McKeown was headed on by Cook but the ball bounced away from the striker and into the hands of visiting keeper Alex Smithies.
The visitors sent out another early warning when a shot from the edge of the box was parried by the Mariners goalkeeper but the offside flag went up as Paterson looked to pounce from the rebound.
Midfielders Norwood and Jonathan Hogg both had shots saved as McKeown started as the busier of the two keepers, before Danny Ward was presented with a chance after Neilson gave the ball away but the effort was deflected out for a throw-in.
Town were yet to get into the game as the 10-minute mark passed, with the away side keeping possession and building pressure on the home goal.
The Mariners then began to see a little more of the ball but when their first shot came through Cook, it went a long way wide of the mark.
A sign of better things came with a run and cross from Colbeck on the right but his low ball proved just too far ahead of Cook and it went out for a goal kick at the far post.
Neilson and Thomas then linked up down the left but the full-back’s low cross was easy for Smithies.
A Thomas shot from 25 yards was deflected away for Town’s first corner on 18 minutes but the set piece came to nothing as Thomas headed wide.
The next Grimsby attack brought the opening goal, as a clever ball from Neilson found Colbeck in space on the right. He ran into the box before pulling it back for HANNAH to side-foot home from six yards.
A foul on Paul Dixon on the left gave Huddersfield a chance to hit back within three minutes but Adam Hammill’s in-swinging free kick beat everybody and went out for a goal kick at the far post.
Adam Clayton fired wide from 20 yards after good defending from the Mariners had prevented a shooting opportunity closer to the goal.
Since the goal though, Town had enjoyed a good spell, spending much more time in the Huddersfield half and creating more danger.
Bignot was forced to concede a corner on 36 minutes but it was cleared, before a long-range shot from Dixon was held by McKeown.
Doig did well to slide in and block a shot from Hammill soon afterwards, which resulted in another corner. This time, the referee blew for a Town free kick as the ball came across from Ward.
One added minute was played at the end of a half in which the hosts had grown in confidence as it went on.
And as the half-time whistle blew, the Mariners were the better of the two sides and deserved their advantage at the interval, despite Huddersfield’s promising start to the game.
No changes were made by either side before the restart and Huddersfield started strongly again, winning a corner on the left two minutes in. The danger from the flag was comfortably dealt with though, as Neilson won a goal kick.
It looked like Town had created a chance when Cook did well to win a header and send Hannah through but the offside flag went up against the former Bradford City striker.
And soon afterwards, Huddersfield were level when they were awarded a free kick 25 yards out in a central position and NORWOOD stepped up to curl a shot beyond McKeown and into the net.
A free kick at the other end gave Town an opportunity to put more pressure on Smithies’ goal but Colbeck sent his delivery straight to the keeper.
Another free kick after a spell of Town possession had a similar outcome, as Colbeck’s driven ball was taken by Smithies.
A double substitution for the visitors saw Sean Scannell come on for Ward, while Hogg was replaced by Duane Holmes.
Clayton dived in a poor attempt to win a penalty in front of the travelling Huddersfield supporters, before a shot from Hammill went well over the bar.
Town had their lead back just after the hour when a long, high cross from Colbeck was superbly controlled by Cook and after he chipped the ball back into the danger area,, DISLEY connected with it to send it past Smithies. The Mariners skipper was then booked for his celebration.
Huddersfield were straight back on the attack and substitute Scannell won a corner on the left but it came to nothing.
A foul on Disley on halfway earned Norwood a yellow card, before Grimsby’s first change saw McLaughlin come on for Thanoj.
Neilson won a corner on the Town left as the hosts looked for a third goal and it led to Pearson having a header blocked before Smithies eventually gathered as Hannah headed it back across goal.
Dixon was booked for an off-the-ball block on Bignot as the away side attacked, then Colbeck’s block gave Huddersfield a corner on the left after another spell of Town pressure.
That turned into a second corner on the opposite side, which was dealt with by Thomas, who headed clear.
McLaughlin then won the ball in midfield to launch another Town attack but Cook could not work the space to get a shot in from inside the box.
Hammill fired tamely wide at the other end on 75 minutes as the Championship side continued to be frustrated by their non-league hosts, who won another corner through Hannah moments later. McLaughlin’s delivery found its way to Thomas but his header was brilliantly kept out by Smithies, who tipped it over the bar.
Town kept up their pressure and another McLaughlin corner from the right on 77 minutes was headed just wide by Thomas.
Christian Lopez replaced Hammil soon afterwards and the next Huddersfield attack saw Paterson have a shot blocked for a corner, which was claimed by McKeown.
Scannell cut in from the left and shot from 18 yards two minutes later but his effort was well blocked by Pearson.
A low drive from Thomas at the other end was stopped by Smithies at his near post as the game moved at pace from end to end, before a Scannell header went out for a Town goal kick.
Rodman replaced Neilson for the last eight minutes of the game as Town looked to close out a famous win.
But the visitors drew level again with four minutes left, when a shot from Scannell was pushed out by McKeown but only to the feet of PATERSON, who slotted home from 10 yards.
A foul on Thomas near the left touchline gave Town a free kick but the ball to the edge of the box was cleared.
Rodman was booked for a foul just inside his own half but Huddersfield were unable to capitalise from the resulting free kick.
But the visitors had their winner on the stroke of 90 minutes, when a cross from the left was back-heeled into his own goal by THOMAS.
It was tough on the Mariners, who had been less than five minutes from glory but they can be proud of their efforts, albeit in defeat.
Town are next in action when they host Maidenhead United in the FA Trophy on Saturday.