New York City commuter train rounding a riverside curve derailed and came to rest only inches from the water Sunday,…