'By the time I reached the railway station the train had left' correctly uses past perfect tense for the earlier action. The sequence is: (1) train left (earlier past), (2) I reached (later past). When two past actions occur in sequence, the earlier one uses past perfect. 'Reached' (simple past) is correct for the later action. Other tenses don't convey this proper sequence.