What causes the change in Bilbo's relationship with Thorin during the siege of the mountain?
Unfortunately, dwarves are not known for their gentleness of temper or forgiving natures. Bilbo invokes Thorin's wrath when the dwarf realizes that his prize Burglar has, in fact, burgled his prize heirloom, the Arkenstone, right out of the hoard in the Lonely Mountain.
Now, Bilbo did not undertake this action lightly, realizing the value of the Arkenstone and how precious it was to Thorin. The hobbit gives the gem to Bard to aid in the stand-off between the dwarves, men, and elves over the treasure in the Lonely Mountain. Thorin believed all of the treasure should belong to the dwarves, since they undertook the risk of retrieving it; the lake-men and elves feel that they too deserve a share as repayment for their losses during the dragon's terrible reign. Bilbo tells Bard that the Arkenstone "is also the heart of Thorin. He values it above a river of gold. It will aid you in your bargaining" (244).
When Bard presents the Arkenstone as a bargaining piece to Thorin, the dwarf becomes incredibly angry, accusing the lake-men of being thieves. Bilbo, at this point, squeaks out that he gave it to them. Thorin sees this as an utter betrayal, vowing "Never again will I have dealings with any wizard or his friends" (247).
At the end of the battle as Thorin "lay wounded with many wounds," the proud dwarf calls for Bilbo and confesses "I wish to part in friendship from you, and I would take back my words and deeds at the Gate" (258). Bilbo later reflects, "I wish Thorin were living, but I am glad that we parted in kindness" (259).