You'll have to be more specific about what blowing up the train maps to in real life before I can tell you whether or not doing so would also kill a shit ton of people.
But to keep it in metaphor, there are also innocent people riding the train and blowing it up would kill them, too.
Most of them, sure. But killing them with any kind of regularity would have a number of knock-on effects that would severely decrease many people's quality of life.
If your friend has a brain tumor, you don't point a gun to their head and shoot it out. You find brain surgeons and have them remove it under controlled conditions. Supposing you can't find a brain surgeon, it would still be better to learn brain surgery yourself and do a careful and thorough job than it would be to just shoot your friend in the head and hope for the best.
It's close enough to the tracks that it would hurt the hostages, and the wreckage would probably have enough momentum to hit them anyway.
This is a good analogy actually. Blowing up the train would feel good, but that isn't going to stop the momentum, and it's unfortunately virtually impossible to outright stop it's momentum at this point. All that blowing up the train would accomplish is sending fiery wreckage towards the middle track.