Ten-man Sunderland U23s are out of the Premier League Cup after conceding a 95th minute equasliser against Wigan U23 at Eppleton.
The Black Cats needed to win to have any chance of going through to the knock-out stages of the competition, and they were cruising after sub Zak Johnson scored just before half-time and then Wigan's Harry McGee put through his own net soon after the interval.
But Sunderland pressed the self-destruct button in the final five minutes.
Keeper Jack McIntyre was sent off for two bookable offences in the space of a minute, the second of which also cost his side a penalty.
With all three subs used, defender Ugonna Emineke donned the gloves and he could not stop Harry McHugh converting from the spot.
And then in the fifth minute of injury time, Tom Costello headed home the equaliser from a free-kick and that was the goal that ultimately proved costly.
Wigan will go through to the next round as group winners, and either Leeds United or Mansfield Town will go through in second place.
U23 coach Michael Proctor were back on familiar territory having recently stepped up to take interim charge of the first team during the club's search for a new head coach.
And the new boss Alex Neil and his assistant Martin Canning were at Eppleton to watch the U23s in action.
Sunderland created an opening down the left inside the first five minutes as Caden Kelly laid the ball off to Spellman, but his low shot was saved by the keeper.
Wigan's first chance fell to Dean Pinnington midway through the first period, but his effort from outside the box flew wide of the right-hand post.
The Black Cats had to make an unplanned change a couple of minutes later when Tyrese Dyce picked up a knock and, despite trying to continue, he eventually went down and had to be helped from the field with Johnson replacing him.
Sunderland began to build up a head of steam towards the end of the half, and they took the lead on 43 minutes.
Kelly's deep corner from the left was headed back across goal, and Johnson was there to lash the loose ball home from seven yards.
Sunderland were forced into a second change four minutes after the restart when Benji Kimpioka picked up an injury and was replaced by Harry Gardiner.
But 60 seconds later, Sunderland extended their lead.
They won a free-kick outside the the right edge of the penalty area, Harrison Sohna delivered the ball into the box and both Spellman and Wigan midfielder McGee went up to meet it but the final touch appeared to come off the head of the Latics man which sent it in off the left-hand post.
And Sunderland should have added a third goal 20 minutes from time when left-back Nathan Newall sent in an inviting cross which Ethan Kachosa connected with at the far post, but his volley went just wide.
Costello sent a header narrowly wide as the visitors looked for a goal to get them back into the game.
At the other end Kelly curled a free-kick just wide from the edge of the D.
McIntyre was fortunate to escape with only a yellow card late on when he brought down a Wigan player just outside the box, but seconds later he was booked again and sent off, this time for fouling McGee inside the area.
Sunderland had used all three substitutes and that meant centre-back Emineke had to don the gloves, but he could not stop McHugh's spot-kick.
That set up a frantic finish with Wigan pushing hard for an equaliser, and it duly came with virtually the last attack of the game when Pinnington's free-kick from the right was headed in by Costello.
Sunderland U23: McIntyre, Kachosa, Jessup, Emineke, Newall (Fieldson 73), Scott, Sohna, Dyce (Johnson 24), Kelly, Spellman, Kimpioka (Gardiner 49). Subs not used: Jones
Booked: Emineke, Kelly, Johnson, McIntyre
Sent off: McIntyre
Wigan Athletic U23: Tickle, Lloyd. Owens. Long, Sobowale, McGee, McHugh, Pinnington, Sze, Baningime, Costello. Subs not used: Mooney, Sumner, Knowles, Grewel
Booked: McHugh
Referee: Garreth Rhodes (West Riding)
Attendance: 194
For the latest Sunderland news direct to your inbox, go here to sign up to our free newsletter