Army Captain Tom York is sent to contact General Custer at Little Big Horn, however by the time he arrives, all he finds is the massacred 7th Cavalry and the Sioux walking around. Tom York rides into the town of Deadwood in order to find a telegraph that he can use to warn the other regiments heading towards Custer's former location. The locals mistake York for a deserter until his friend Ep Wyatt vouches for him.
Somewhere in the area is hidden a pair of Gatling guns, which would be vital to fending off such an assault. The only person who knows the hiding place is Dakota Lil, a saloonkeeper who already has lost her husband and son in battle and wants no more part of it.
Ultimately persuaded by York to reveal where the guns are, they are betrayed by a gambler, Elkins, who intends to sell them to the enemy for a profit. York and others manage to get them back, and once everyone in town is safe, he decides to put down roots there with Dakota Lil.