Crewe fought back to claim a shock win Gudjon Thordarson's first league game in charge.
Hayes had fired the Iron in front in the 19th minute after strike partner Gary Hooper was given a second chance to put the ball back across the six-yard box.
That made up for his dreadful penalty miss ten minutes earlier. Hayes rolled the kick well wide of the post after Luke Murphy had tripped Martyn Woolford.
Crewe went close through a Julien Baudet header and Murphy's piledriver just cleared the bar.
But Hayes also sent in a 30-yard volley which crept over and he and Hooper were a handful for the home defence.
Yet Thordarson brought on frontman Byron Moore and with three up front in the second half Crewe offered much more of a direct threat.
Matt Sparrow shot tamely at Stuart Tomlinson as the visitors threatened a second and home striker Shaun Miller lifted an effort over when he was well-placed to get an equaliser.
But the Railwaymen did draw level when Marcus Williams was punished for a push on John Brayford.
Michael O'Connor stepped up and sent Joe Murphy the wrong way with a confident penalty on the hour mark.
Thompson came close to restoring Scunthorpe's lead a minute later, pulling a shot wide of the far post.
And more poor defending let the visitors edge in front again when Sparrow's delivery was flicked on by Hooper at the near post and O'Donnell, trying to clear, put the ball over his own line in the 69th minute.
Yet Crewe struck back within three minutes with Clayton Donaldson taking a Brayford pass and driving over Murphy.
And after Miller had struck the bar from close in when it seemed easier to score, O'Donnell made amends for his own goal by firing the winner home deep into stoppage time after Scunthorpe failed to clear a Billy Jones free-kick.
Hayes had fired the Iron in front in the 19th minute after strike partner Gary Hooper was given a second chance to put the ball back across the six-yard box.
That made up for his dreadful penalty miss ten minutes earlier. Hayes rolled the kick well wide of the post after Luke Murphy had tripped Martyn Woolford.
Crewe went close through a Julien Baudet header and Murphy's piledriver just cleared the bar.
But Hayes also sent in a 30-yard volley which crept over and he and Hooper were a handful for the home defence.
Yet Thordarson brought on frontman Byron Moore and with three up front in the second half Crewe offered much more of a direct threat.
Matt Sparrow shot tamely at Stuart Tomlinson as the visitors threatened a second and home striker Shaun Miller lifted an effort over when he was well-placed to get an equaliser.
But the Railwaymen did draw level when Marcus Williams was punished for a push on John Brayford.
Michael O'Connor stepped up and sent Joe Murphy the wrong way with a confident penalty on the hour mark.
Thompson came close to restoring Scunthorpe's lead a minute later, pulling a shot wide of the far post.
And more poor defending let the visitors edge in front again when Sparrow's delivery was flicked on by Hooper at the near post and O'Donnell, trying to clear, put the ball over his own line in the 69th minute.
Yet Crewe struck back within three minutes with Clayton Donaldson taking a Brayford pass and driving over Murphy.
And after Miller had struck the bar from close in when it seemed easier to score, O'Donnell made amends for his own goal by firing the winner home deep into stoppage time after Scunthorpe failed to clear a Billy Jones free-kick.