Six-axle locomotives are often used on railways of different countries. That is why the study of such vehicle dynamics in various motion regimes is important. To carry out the investigations, first of all a mathematical model of the locomotive spatial vibrations was developed. The computational scheme was submitted as a branched system of nine rigid bodies and twelve reduced masses of the track joined by linear and non-linear connections with various rheology. Physical and geometrical interaction of wheels and rails was taken into account. The model and specially developed software allowed studying locomotive motion along straight, curved, and transitional track segments both at constant and variable speed of motion with taking into account random track irregularities. The possibility of emergency situations investigation was also taken into account in the developed mathematical model. One of the most often accident for railway trains is locomotive and cars derailment. The reason of such accident as a rule is not one but a number of factors strengthening each other. In the paper different reasons of derailment were under investigation. The locomotive collision with an obstacle was the subject of special research. Locomotive behaviour at its collision both with a motionless obstacle and another vehicle (moving obstacle) was studied. The obtained results are discussed in the paper.