Martin O’Neill’s side had looked to be heading for a seventh defeat in 11 matches.