The opening goal arrived in the 23rd minute. The Stags moved the ball out from the back and eventually found Kieran Carter. He played a first-time cross into Marcus Bedford, who took a touch away from the defender and smashed past Josh Wilson in the Wanderers goal.
Wanderers levelled on stroke of half-time when Conan Torpey got through and squared to Nabeel Ghannam, who easily beat Midhurst stopper Josh Bird.
Stags found the winner in the 80th minute – Bedford found space and played a great ball into the box which was headed away and Carter volleyed home.
Photographer Tommy McMillan was at Meadowbank to capture the action. You can view a selection of his shots in the gallery below.