Morecambe came from behind to book their place in the Conference play-off final with two Wayne Curtis goals.
McIlroy was confident of success after a 0-0 stalemate in the first leg
York went ahead through a Steve Bowey spot-kick after home goalkeeper Steve Drench had fouled Clayton Donaldson, dislocating his elbow in the process.
But the hosts responded well, Curtis meeting an Adam Yates free-kick with a looping header over City stopper Tom Evans before clipping in a second.
Sammy McIlroy's team will meet either Exeter or Oxford in the Wembley final.
However, after Bowey's 20th-minute opener Morecambe looked a long way from that 20 May date and a first play-off final at the third attempt.
Drench and Donaldson clattered into each other on the edge of the area as they challenged for Manny Panther's long ball over the top and, after a lengthy delay, substitute keeper Scott Davies went the wrong way at the penalty.
But Evans gifted the Shrimps a way back into the game when he raced to the edge of his six-yard box and was caught in no-man's land as Curtis met a Yates free-kick from the right.
And shortly after the interval Curtis completed the comeback.
Evans twice blocked right-footed efforts from the striker on the left before Curtis opted for a cute, lofted finish off the outside of his left boot.