In 1876, Johnny Jameson (Dan Dailey), a "drummer" (traveling salesman), is the only passenger on the inaugural run of the Tomahawk and Western Railroad's narrow gauge train through the Colorado Rockies. During the ride, the conductor tells Johnny that certain people, stagecoach operators for example, would like to see the railroad's franchise fail. Soon afterwards, Dakota (Rory Calhoun), Trancas and Gila, who work for Colonel Dawson, the area stageline operator, cause a giant boulder to fall directly in the path of the train. Engineer Terence Sweeny (Walter Brennan) manages to stop the train in time, and he and the crew then disembark to move the rock.
Johnny decides to walk to the town of Epitaph and hitches a ride with Trancas and Gila. At the sheriff's office, when Johnny tries to report the train's delay to deputy Chuckity Jones (Charles Kemper), he is knocked out by Trancas. U.S. Marshal Kit Dodge, meanwhile, is in the room next door getting ready to welcome the train with help from his tomboyish, knife-wielding granddaughter Kit (Anne Baxter). As they leave for the depot they are surprised by Trancas and Gila. The marshal shoots Trancas but is wounded by Gila. Johnny comes round and Kit suspects that he may also be one of the gang. Despite Chuckity intervening on his behalf she orders him to leave town before sunset.
Kit is deputized as a U.S. Marshal by her grandfather, who now cannot travel because of his wound. She and an Indian companion named Pawnee (Chief Yowlachie) are assigned to escort the train to Tomahawk. Colonel Dawson orders Dakota to join the posse that is escorting the train and also an Indian scout, Black Wolf, to stir up the local Arapahos. Other gang members plot to blow up the engine during a night stop.
Only after he has bought his ticket out of town does Sweeny learn that there is no track laid for the next forty miles. He is informed by local railway entrepreneur, Bishop, that the rails were lost at sea en route from England. Bishop explains that as the train must reach Tomahawk to fulfill the requirements of the franchise contract, he has arranged for the engine car to be hauled by a team of mules. Another condition is that the train must reach Tomahawk by a rapidly approaching deadline with at least one paying passenger. Kit is not pleased to discover that the passenger assigned to her care is Sweeny. Johnny, now reluctant to travel on the train, is roped alongside the cab as the locomotive, minus its passenger car, sets off pulled by the mules and accompanied by assorted wagons. Chinese laundry man Long Time (Victor Sen Yung) joins the group with much delayed laundry for Tomahawk, together with Madame Adelaide (Connie Gilchrist) and her dancing girls, Annie, Ruby, Clara (Marilyn Monroe) and Julie. A musician with pionola accompanies them.
As planned, Dawson's men Bat, Charley and Fargo show up at a night stop claiming to be telegraph men who are there to repair lines cut by the Arapahos and Kit gives them permission to bunk in the camp. Gradually Kit softens her attitude towards Johnny. When all are asleep, Bat and Charley leave while Fargo tosses sticks of dynamite under the engine. Johnny, sleeping alongside the train, smells the lit fuse and alerts the others. Kit then cuts the fuse with a shot and disables Fargo but before he can talk Dakota kills him.
Some time later, a few miles beyond where the track restarts, Bat and Charley are placing dynamite charges on a trestle bridge. Johhny, Kit and Pawnee are scouting ahead and stop at the bridge. Bat and Charley consider shooting them but are then themselves attacked and killed by Indians and the dynamite is set off prematurely. Kit, Johnny and Pawnee are chased back to the train which is then attacked by the war party. Johnny identifies the Arapaho chief, Crooked Knife, having previously worked with him in a travelling western show. After the war party is driven off, Johnny volunteers to talk peace with him. He has learned that Long Time is carrying a load of fireworks and develops a plan. He is welcomed by Crooked Knife, who agrees to allow the train safe passage. However, some of the braves distrust Johnny and ask him to produce a sign that he is "big medicine." Johnny sets off a rocket, signaling Kit and Dakota to set off the rest of the fireworks on a nearby hill, and the Indians are impressed. As the railway bridge is now out, Kit intends to take the thirty-three-ton locomotive over a mountain by dismantling it and carrying it in sections. Dawson, meanwhile, thinks he has been double-crossed and shoots Black Wolf. He then rounds up his men for a final showdown.
After Kit discovers that Dakota has sabotaged a vital water tower, Dakota jumps aboard the train, slugs Johnny and at gunpoint makes the fireman start the engine rolling and takes off at high speed down the tracks. Kit jumps into the cabin but is knocked out by Dakota. Johnny revives and while he and Dakota fight on top of the cabin, Kit comes round and throws her knife at Dakota, causing him to fall into a ravine. Dawson and his gang then ambush the train but cannot catch up with it. However, they manage to shoot up the boiler and the train slows to a halt within sight of Tomahawk. A posse, headed by Marshall Dodge, rides out from the town and, together with the Araphoe, subdue Dawson's gang. Dawson flees but is pursued by Pawnee who throws a tomahawk at him which hits home off camera. As the train has stopped just short of its goal, Johnny talks the mayor of Tomahawk into extending the town limits, thereby fulfilling the requirements of the franchise. He does so, with seconds to spare. By now Kit has fallen in love with Johnny but he says he cannot be with her as he could not give up his travelling life. She grabs her knife and threatens to cripple him to stop his wandering ways. In the next scene it becomes apparent that Johnny is now working as a train conductor. As the train sets off he quickly limps after it, waving to his wife, Kit, and their five young daughters...Dan Dailey as Johnny Behind-the-Deuces
Anne Baxter as Kit Dodge Jr.
Rory Calhoun as Dakota
Walter Brennan as Terence Sweeny
Marilyn Monroe as Clara (uncredited)
Charles Kemper as Deputy Chuckity Jones
Connie Gilchrist as Madame Adelaide
Arthur Hunnicutt as Sad Eyes
Will Wright as Dodge
Chief Yowlachie as Pawnee
Victor Sen Yung as Long Time