There is a grey area in the choice of tenses between PAST SIMPLE and PAST PERFECT.
In many situations, both are idiomatic. Speakers and writers seldom pause to consider which tense might be more suitable in any given context, they simply speak or write.
In your first example, it's more natural (after the expression by the time) to use the PAST PERFECT:
By the time I got to the station, the train had left.
In your second example, this isn't true.
Most native English speakers would use It left five minutes before.... It's simply a natural way of speaking.
It would also be correct to say had left five minutes before.... and some people might use this tense to emphasise a point. But this does not improve the sentence or make it any clearer.
In short, both constructions are fine - as is frequently the case.