Dáin set out with an army of Dwarves to the aid of his royal cousin. It is uncertain whether Dáin's son Thorin accompanied that army (he was certainly old enough to do so by that time, but he may have remained behind to ensure the survival of the line of lords; at the very least, no mention is made of him in the annals of those events). At Erebor, Dáin fought in the Battle of Five Armies against an unforeseen incursion of Orcs, and though the Orcs were defeated, Thorin II was slain in that battle, as were both the remaining heirs of his line, Fíli and Kíli.
This unexpected turn of events left Dáin II the natural Heir of Durin, and Thorin Dáin's heir in turn. Dáin thus became King under the Mountain, and ruled until he was slain defending Erebor in the War of the Ring. At that time the Lonely Mountain was besieged by Sauron's forces, and Thorin was among the defenders. After it became known that Sauron had been absolutely defeated in the South, Thorin was able to drive the dispirited besiegers away.
With the loss of his father Dáin, Thorin became King of Durin's Folk, the third to bear that name. He would have ruled through most of the first century of the Fourth Age, though we know little of his reign. Soon after the defeat of Sauron, Gimli took many of the Dwarves of Erebor south to settle at Aglarond, and to rebuild the Great Gate of Minas Tirith in mithril. It seems certain that Thorin III must at least have given permission for these events to take place (and presumably actively assisted them, especially given the need of precious mithril for the new Great Gate).
Thorin's epithet of Stonehelm is as mysterious as almost everything else about his life, and we have no account to explain how he received it. It was most likely acquired in battle, perhaps at the Battle of Five Armies or the Battle of Dale, though the detailed circumstances of the title's origin are not known.
Notes
1
We have no explicit record of the date of Thorin's death, but the Dwarves of Durin's line typically lived to about the age of two hundred and fifty, with very little variation from one generation to the next. It's safe to assume, therefore, that Thorin III lived until about the year IV 96.
2
It seems likely that Thorin III received his name in memory of his illustrious forebears Thorin I and (especially) Thorin II Oakenshield, who had recently become the King of Durin's Folk at the time of Thorin III's birth.