Hmm, wondering if that's a depiction of 'The Signalman' in the ghost story of that name published in 1866 by none other than Charles Dickens. The tale was said to have been inspired by his involvement in a bad railway accident at Staplehurst, Kent in 1865.