The elephant is no more wonderful than his biographers usually make him. It was to his lordly self that a railway accident was due on the Perak State Railway [Malaya] in September. The last train for the day was about three miles distant from its destination (Teluk Anson), and was running at about twenty miles an hour, when the fireman noticed something on the line. He called to the driver, who immediately shut off steam. Too late, however, for the train collided violently with a huge object, which proved to be a wild elephant that had strayed on to and was crossing the line at the time. The elephant had one of its legs broken, and half cut off; a part of the trunk was also cut off. The monster itself was thrown down the bank, where it soon died from loss of blood. The engine was also derailed.
— The Sketch, Jan. 16, 1895
I can find two stories of subsequent “duels” between elephants and locomotives on the same line. The Singapore Free Press and Mercantile Advertiser (1926) describes one that took place in 1897, and Forest and Stream has an account of one in 1900. Neither mentions the other, though, so I think perhaps they’re describing the same encounter.