A 93rd minute Florian Kamberi strike saw Mansfield fall to a cruel defeat at One Call Stadium in the Papa John’s Trophy.
Wednesday took the lead through a 63rd minute Lewis Wing header, rising to meet Marvin Johnson’s delivery.
Ex-Blade Stephen Quinn drew Mansfield back level five minutes after with his strike from inside the box.
Kamberi put the visitors back ahead with one of the final kicks of the contest.
Nigel Clough made four changes to the side that faced Harrogate Town in Mansfield's last Papa John's Trophy outing.
Centre back George Cooper made his first Stags' start, taking his place next to Farrend Rawson in the heart of defence.
League suspended duo Stephen Quinn and Tyrese Sinclair also made returns to the starting XI.
Mansfield started well as Harry Charsley’s shot from inside the box was blocked by a sliding Lewis Gibson inside three minutes.
Theo Corbeanu presented Wednesday’s first threat of the game after 10 by finding space down the right. A blocked challenge inside the box allowed Shelvey to come from his line and collect the danger.
The Canadian forward tried to use the strong winds to his advantage by letting fly from range three minutes later. Despite plenty of lateral movement on the effort, Shelvey was able to palm it clear.
Johnson’s driven ball through the box narrowly evaded the bottom right corner of Mansfield’s goal on 20 minutes after the wing back had found space on the left.
Five minutes later Jason Law’s inswinger found Keaton Ward who skewed a header over from a promising position inside Wednesday’s box.
Johnson’s cross in the 38th minute dropped inside Mansfield’s box. Striker Saido Berahino struck the loose ball into the body of Cooper, whose block kept the scores level.
Quinn played in Tyrese Sinclair minutes later but one on one with the ‘keeper, Sinclair dragged his effort wide of the left post.
Law linked up with Sinclair in the final minute of the half who delivered a left sided cross into Johnson. On the slide, the Mansfield striker couldn’t make a true enough connection to trouble Wildsmith.
Mansfield attacked following the break as Sinclair’s effort from just outside the box tested Wildsmith on 50 minutes.
A Jason Law effort four minutes later seemed to deceive Wildsmith before the Owls stopper managed to glove the effort around the post with a late lunge to hid right.
Corbeanu continued to cause problems for Stags and struck the outside netting on the hour mark having beaten Elliott Hewitt.
The introduction of Jaden Brown for Wednesday moved Johnson to right back. The 30-year-old's first impact on the opposite side was to deliver a 63rd minute in-swinging cross to Wing who nodded over Shelvey to take the lead for the visitors.
Mansfield replied straight back in the 68th minute. James Clarke intercepted a loose ball on the edge of the box to find Sinclair who back-heeled the ball straight into the path of Stephen Quinn inside the box. The former Sheffield United man struck the ball first time with his in-step to beat Wildsmith and level the scores.
Clarke’s 77th minute diagonal played Quinn in again on the left. This time the Irishman’s dinked effort beat the post to let Wednesday off the hook.
Corbeanu again wandered down Mansfield’s left side before weaving his way one on one with Shelvey. The on-loan Forest man stood up well to make a strong save in front of the away end.
Two minutes later Sylla Sow advanced to meet Wing’s through-ball but the forward’s shot on an angle missed the bottom left corner narrowly.
Corbeanu was Mansfield’s undoing at the death, weaving inside to tee up Kamberi who converted into the roof of the net from close-range.
MANSFIELD XI: Shelvey (GK), Rawson, Charsley (Lapslie 72’), Johnson, Burke, Quinn, Sinclair, Ward, Clarke, Law (Oates 79’), Cooper (Hewitt 46’)
UNUSED SUBS: Stech (GK), Bowery, Charles, Gale
SHEFFIELD WEDNESDAY XI: Wildsmith (GK), Gibson (Palmer 46’), Dele-Bashiru, Johnson, Kamberi, Dunkley, Corbeanu, Berahino (Shodipo 46’), Wing, Hunt (Brown 61’), Saw
UNUSED SUBS: Render, Iorfa, Adeniran, Adedoyin
REFEREE: Rebecca Welch
ASSISTANTS: Stephen Wade & Matthew Perry
FOURTH OFFICIAL: Scott Tallis