Two quickfire goals in the second half, one for either side, seemed to be sending this Papa John’s Trophy tie to penalties as Mansfield and Wednesday went head to head at the One Call Stadium.
But Florian Kamberi struck right at the last to ensure the Owls stay top of Group H and guarantee qualification to the knockout stages.
Earlier, Lewis Wing claimed his maiden goal in Wednesday colours which was promptly cancelled out by Stephen Quinn before Kamberi had the final say.
Theo Corbeanu stood out for the visitors, looking sharp down the right, and the wideman warmed the gloves of George Shelvey from distance early on, setting the tone for a lively performance.
Marvin Johnson then flashed a low feed across goal that evaded no less than three of his onrushing team mates and the Stags had a lucky escape.
Corbeanu was proving a real thorn in the side and twice went on mazy runs where only the final ball was missing.
Keaton Ward sent an inviting corner wide at the other end and might have done better with a free header.
Sylla Sow and Saido Berahino had half chances inside the box as half time approached but the best opportunity of the opening period fell to Tyrese Sinclair, who skewed wide after bearing down on goal five minutes before the break.
Wildsmith gathered a whistling Sinclair strike immediately after the restart before the Wednesday keeper did well to tip Jason Law’s deflected effort past his near post.
Corbeanu set off on a trademark run down the right and cut inside to blast into the side-netting on the angle before Wednesday broke through on 64 minutes.
Johnson swung a deep cross into the heart of the area, Wing and Shelvey leapt together and the former came out on top to glance home.
But the lead would last only five minutes as the Stags hit right back. A clever three-man move was ended emphatically by Quinn, whose fierce drive arrowed into the top corner.
Mansfield pressed for a winner but Wednesday went close nine minutes from time when Corbeanu again showed trickery and guile to burst into the box but Shelvey thwarted the Canadian with a smart save.
The Stags keeper was relieved moments later to watch Sow’s angled shot fly wide but could do nothing to keep out Kamberi in stoppage time six yards out after more terrific approach play from man of the match Corbeanu.
Wednesday: Wildsmith, Hunt (Brown 61), Dunkley, Gibson (Palmer 46), Johnson, Corbeanu, Wing, Dele-Bashiru, Sow, Berahino (Shodipo 46), Kamberi