Midson, in his 100th appearance for the club, struck from the penalty spot with 18 minutes to go after Andy Mangan had cancelled out Gary Alexander’s header in a dramatic second half.
Victory lifted the Dons out of the relegation places and instead condemned Barnet, with whom Midson spent a spell on loan in 2011, to non-league football next season.
Midson almost gave the Dons the lead just before the half-hour mark when he headed Sammy Moore’s free-kick against the crossbar.
After the break Midson pounced on a mistake by Nathan Pond but his shot hit the woodwork and Harry Pell’s rebound was cleared off the line by Shaun Beeley.
But 15 minutes into the second half the home side finally went ahead when Alexander rose highest to head Moore’s free-kick past Scott Davies.
Just a minute later the Cod Army equalised when a corner was whipped into the six-yard box and Mangan bundled the ball over the line from close range.
Yet when Rob Atkinson brought down Curtis Osano in the box, Midson stepped up to slot home the resulting penalty and put the Dons back in front and maintain their League Two status.