The Mansfield Woodhouse side, who are struggling near the bottom of the Midlands 5 East (North) table after only two wins all season, looked in control at half-time as they led 24-17.
But the mid-table All Blacks had other ideas and, inspired by man-of-the-match Ryan Woods, they mounted a second-half recovery in which they prevented Giants from adding a single point to their tally.
The recovery began when Tom Mell delivered a beautiful inside pass to Andy Turner-Guest, who ran 30 metres to score the visitors’ bonus-point try. It was unconverted but it left All Blacks trailing the home side by only two points.
As they strove for the winning points, Gainsborough produced some cracking tackles and they surged in front thanks to a couple of successfully kicked penalties by Mell.
Mansfield Town boss Nigel Clough proud of players and fans as Stags are pipped by Derby County in Carabao Cup classic
One more new face in for Mansfield Town as early injuries mount?
See who you can pick out in our fans gallery from Mansfield Town v Derby County
Derby County boss Liam Rosenior has high praise for Mansfield Town after winning Carabao Cup thriller
Battling 10-men Mansfield Town push neighbours Derby County all the way in thrilling Carabao Cup exit
The comeback was completed when prop James Taylor dived over to score the final try of the match and although it asn’t converted, All Blacks could celebrate their triumph.
In the first half, Woodhouse had broken out of the blocks quickly, turning possession into a try, which was converted.
Fielding veteran Wayne Sandall, the visitors hit back when the influential Mell raced down the left to score a try of his own. And then second-team captain Paul Hooton celebrated his call-up to the side by spotting a gap and pouncing to cross the line for All Blacks’ second try.
Woodhouse responded in style, going over for three more tries, although only one was converted, and the rich entertainment continued when Daniel Chadwick scored another try for Gainsborough in the last piece of action of the opening period.
The victory was the All Blacks’ seventh of the campaign and kept them in sixth place in the ten-team table, only six points behind fourth-placed Skegness, whom Woodhouse play in their next match on Saturday, April 2.
The Gainsborough outfit do not have a game over the Easter weekend, but they also return to action on Saturday, April 2 with an away fixture against fifth-placed Keyworth.