It's not going to flip. Tolleys derail all the time (ask people living in Wrocław). They can't go fast enough to flip. It will just stop after couple of meters.
So now we have to check the global statistics and figure out what's the probability is of someone dying in a derailment and estimate if we should risk it or just let the one guy die. Fun!
The people in the train are the only ones with any power to stop it, but they're divided between "smash everyone quickly" and "smash everyone slowly" factions.