Newport County staged a remarkable comeback to beat Oldham Athletic 3-2 in a 110-minute match that may save the club from relegation.