Dozens of people, including a young British girl, were injured when a packed train struck a locomotive in western Thailand.