A much-changed Stags side played their part in an end-to-end game, but their League one neighbours had the sting in the tail in the third of four added minutes.
Stags will now prepare for the far more important home clash with fellow strugglers Oldham Athletic on Saturday.
Both sides entertained, despite the swirling wind and rain, and Lewis Wing punished a mistake by home keeper George Shelvey to net on 63 minutes only to see Stephen Quinn level it five minutes later.
With the visitors selling over 1,600 tickets they outnumbered the home fans to create a great atmosphere for a group game.
Wednesday had won their opening group fixture while Stags lost 3-1 at Harrogate Town.
Nigel Clough made nine changes from the weekend in a side which included suspended trio Farrend Rawson, Quinn and Tyrese Sinclair.
Young right back James Clarke was handed the captain's armband while 18-year-old centre half George Cooper, 18, was handed a full debut.
Sinclair and Danny Johnson started up front with Jason Law at the tip of a midfield diamond with Keaton Ward at the base, Harry Charsley on the right and Quinn on the left.
For Wednesday, Darren Moore made eight changes.
Goalkeeper Bailey Peacock-Farrell was away on international duty with Northern Ireland so Joe Wildsmith made his second appearance of the season.
Lewis Gibson made a debut and there were recalls for Fisayo Dele-Bashiru, Theo Corbeanu, Sylla Sow and Florian Kamberi.
History was made in the game for Stags with Rebecca Welch becoming the first female to referee a Mansfield Town match and she produced an excellent performance.
Stags were almost behind inside 30 seconds as Shelvey took a touch from a Rawson backpass and saw his clearance charged down by Berahino and fly inches wide of the open goal.
Charsley then had a shot blocked by Gibson from Stags first raid on three minutes.
A Wildsmith clearance then caught on the wind and bounced worryingly wide of the home goal.
On 14 minutes Shelvey had to parry a swirling, powerful shot from 20 yards by Corbeanu and Rawson was on hand to block Berahino's follow-up for a corner.
More home pressure saw Charsley just unable to get his head on Johnson's left wing cross while Johnson drilled a low cross through everyone at the other end.
Shelvey was then down smartly to smother a cross-cum-shot from Corbeanu after a thrilling run by the Wednesday man.
On 26 minutes Ward had Stags' best chance so far but planted a far post free header across goal and over from Law's flag kick.
Shelvey had another moment when he allowed the ball to squirm away from him, but Cooper eventually cleared home lines.
Charsley saw the game's first booking on 28 minutes for a trip on Dele-Bashiru, halting a rampaging run.
Wing warmed Shelvey's hands from 30 yards on 38 minutes but the youngster held onto it.
Cooper made two good interventions on the Owls' nest raid with a header and a block.
Sinclair should have done better on 41 minutes when sent clear on the left by Johnson but sent a low finish just wide as Dunkley went to close him down.
Then a low Sinclair cross was just too hard for Johnson to turn on goal in added time as an entertaining half ended scoreless.
Hewitt replaced the impressive Cooper for the second half.
Wildsmith was safely behind a low Sinclair strike five minutes into the restart and a rising near post effort from the same player soon after.
Shelvey then won a race to clear ahead of the chasing Sow.
Wildsmith had to get down smartly to turn round a deflected low Law shot as Stags resumed their offensive.
The lively Corbeanu flashed a shot into the home sidenetting on 61 minutes.
Burke was added to the notebook on 63 minutes for sliding into the back of Dunkley.
But the visitors were ahead seconds later. Johnson sent in a right wing cross, Shelvey came for it but was out-jumped by Wing who buried a header into the inviting net to finally break the deadlock.
But Stags were quickly level on 68 minutes with a beautifully worked goal.
Clarke threaded a neat ball inside to his left to Sinclair and he backheeled the ball into the path of Quinn who beat Wildsmith with an unstoppable rising finish.
On 77 minutes Quinn almost doubled his tally on a counter-attack but was wide of the far post.
Then on 83 minutes Shelvey made a crucial save after another fantastic Corbeanu run took him into the box.
Sow drilled a finish wide of the far post seconds later and Shelvey had to cut out a dangerous Brown cross as the Owls pressed for the win.
Ward shot tamely wide in the four added minutes as we headed towards penalties.
But in the third of those added minutes Wednesday stole a winner.
Wing found Corbeanu on the right and he jinked to the by-line before crossing low for Kamberi to bury a close range rising finish.
STAGS: Shelvey, J. Clarke, Rawson, Cooper (Hewitt HT), Burke, Quinn, Charsley (Lapslie 72), Ward, Law (Oates 79), Sinclair, Johnson. SUBS NOT USED: Stech, Bowery, Charles, Gale.OWLS: Wildsmith, Gibson (Palmer HT), Dele-Bashiru, Johnson, Kamberi, Dunkley, Corbeanu, Berahino (Shopido HT), Wing, Hunt (Brown 61), Sow. SUBS NOT USED: Render, Iorfa, Adeniran, Adedoyin.
REFEREE: Rebecca Welch.