York City 3 Middlesbrough 3 (Boro win 3-0 on pens)
York City's young reserves twice fought back to lead before eventually losing a penalty shoot-out to Middlesbrough Under-23s in their North Riding Senior Cup semi-final at Bootham Crescent.
The Teessiders enjoyed an interval advantage as Mikael Soisalo was on target at the end of the opening half.
However, Clovis Kamdjo headed an equaliser midway through the second period, only for substitute Stephen Wearne to soon restore the away advantage.
But York struck twice in five minutes through Harry Thompson (82) and Boro skipper Matthew Elsdon's own-goal (86) to suddenly be on the verge of the final.
There was to be a further late twist, though, when the visitors were awarded an injury-time penalty and Stephen Walker followed-up to score after Luke Simpson had initially blocked with his legs.
Boro goalkeeper Brad James then saved each of York's first three spot-kicks from Raul Correia, Josh Law and Aaron Haswell to secure victory in the subsequent shoot-out.
Connor Smith earlier struck wide from distance for the hosts in between a couple of sharp attempts by Mitchell Curry, while Haswell was also narrowly off-target from similar range before Vinnie Steels could only find the side-netting.
Goalkeeper Simpson reacted well at the other end from Curry's low drive, while Boro counterpart James blocked from Correia after Liam Hegarty's shot was charged down.
Smith then exchanged passes with Haswell and fired narrowly wide on the half-hour, with team-mates Flynn McNaughton and Correia also seriously threatening to make the breakthrough.
Boro's Jay Wilson next called Simpson into action from the edge of the area before Correia's angled reply was agsin denied by James.
But it was the visitors going in front moments before the interval when Soisalo finished low, although Kamdjo's close-range header at a free-kick immediately forced another save.
The Teessiders made a double-change at the start of the second period - and one of them, Billal Brahimi, soon hoisted over from a decent position before Haswell curled an effort towards James, who also kept out both Correia and Steels in rapid succession.
However, York equalised midway through the second-half when centre-back skipper Kamdjo rose and headed in Haswell's corner.
Home defender Law soon blazed over from the edge of the area, and the visitors had another escape as James denied both Smith and McNaughton before Correia was in turn blocked on the line.
Law also had a free-kick deflected against an upright, although it was the visitors suddenly reclaiming their earlier advantage when substitute Wearne netted only moments after his introduction.
But five minutes later City's youth-team midfielder Thompson brought his side back into it when heading in Smith's inviting delivery.
Boro skipper Elsdon then dramatically headed another Smith cross into his own net with just four minutes remaining; only for Walker's sudden injury-time equaliser to force penalties after his own 94th minute spot-kick was initially blocked by Simpson.
York City: Simpson, Smith, Law, Wharton, Rogerson, Kamdjo, Haswell, Thompson, Correia, McNaughton, Steels
subs (unused): Berry, Wilton, Lawrence, Kemp, Watson
Goals: Kamdjo (66), Thompson (82), Elsdon OG (86)
Middlesbrough: James, Dodds, Robinson, Hegarty (Storey 46), Dale, Elsdon, Soisalo (Wearne 75), Watts, Walker, Curry, Wilson (Brahimi 46)
subs (unused): Hood, Brynn
Goals: Soisalo (45), Wearne (77), Walker (90)