Both the two sentences "尾班車開出前5分鐘" and "尾班車開出5分鐘前" are fine with the former less prone to misconception. The listener could have missed "前" in the latter sentence when in a hurry, then the sentence becomes "尾班車開出5分鐘~*#@", and he can be late by 5 minutes. :)
The equivalent English sentences:
尾班車開出前5分鐘 - 5 minutes prior to the departure of the bus.
尾班車開出5分鐘前 - 5 minutes before to the departure of the bus.
尾班車開出5分鐘前 has 歧义: it has another reading as before the last bus has departed for 5 mins. This problem is created because different possible syntactical analyses lead to different semantic meanings. 開出5分鐘｜前 is possible (more natural), so is 開出｜5分鐘前.
However, if you change 前 to 后, it works. 尾班車開出5分鐘后 has no 歧义 because 開出5分鐘｜后 (after the bus departed for 5 mins) and 開出｜5分鐘后 (5 mins after the bus departed) leads to the same meaning.
This structure of 尾班車開出前5分鐘 is better since it has no 歧义 and also the reason brought up by @r13. 前 is more emphasized and less likely to miss.