Hmmm, it would take more than the weight of aircraft cannon & machinegun fire to physically tip a locomotive weighing many tons off its rails. A secondary explosion, such as from an ammo car or fuel tanker may be enough to derail a moving train, especially if the force of that explosion was at an angle to the direction of the rails/direction of travel.
Movies also show people being launched many feet backwards by the force of a 12 gauge shotgun (both barrels, no less) but fail to show the shooter getting similarly launched in the opposite direction by an equal degree.
EDIT: This is my favourite train attack scene taken from Dark Blue World: