I tried changing "piston" constraint settings a bit, setting
- world <==> world
- adding X as contraint axis
then I animated the train rotation, to check and it seems to work now,
see the attached file. (btw, next time please use the same service I used, here http://blend-exchange.giantcowfilms.com/, it helps preserving example files for others in future).
as you say in commenmts, there were other issues on different train's movements.
I tried and probably you just need to add also Z axis to the piston contraint, and then ALSO add a location contraint for piston on Z, limiting max Z to its "deafult" Z location in local space, like this:
and it seems to behave well (hopefully) on all desired train movements...