Stanley come back from brink