Jeremiah Wilson, a 62-year-old railroad veteran, is deeply devoted to the Willamette Western Railroad. His world is upended when Brett Banner, the 32-year-old heir to the New York Eastern, convinces his father to buy the railroad. A conflict ensues between Brett and Jeremiah, resulting in Jeremiah's dismissal just two years before retirement. Bitter and disheartened, he becomes withdrawn. When Brett’s nine-year-old son, Justin, learns that Jeremiah's grandson Thomas can drive a locomotive, Justin kidnaps Thomas's beloved dinosaur as a ransom. Justin, Thomas, and three other children then board an old engine undergoing repairs, accidentally sending it careening out of control, triggering a series of unforeseen events.