Gandalf recommends Bilbo Baggins for the job of burglar on Thorin's quest, telling the dwarves that the hobbit is "one of the best--as fierce as a dragon in a pinch (17). Gandalf says this, of course, on the eve of their journey in Bilbo's home as Bilbo plays host to the dwarves. Thorin and company certainly have their doubts as to Bilbo's abilities, but Gandalf refuses to change his original opinion of Bilbo:
"If I say he is a Burglar, a Burglar he is, or will be when the time comes. There is a lot more in him than you guess, and a deal more than he has any idea of himself. You may (possibly) all live to thank me yet" (19).
By the end of their journey, the dwarves have come to appreciate the veracity of Gandalf's original assessment of Bilbo, for the hobbit has proved himself most useful in critical moments. First, he alerts the dwarves to the crack in the cave in the Misty Mountains right when the Goblins were going to attack. Then he outsmarts Gollum and procures for himself a very useful magic ring. Later, Bilbo rescues the dwarves from being eaten by spiders in Mirkwood and secures their release from the Elven-king's dungeons, ingeniously coming up with the solution to hide the dwarves in barrels and float them down the river. At the foot of the Lonely Mountain, it is Bilbo who recognizes the clues from the moon-letter message on Thorin's map and finds the way to open the secret door.
Without Bilbo as their fourteenth companion, Thorin's company would have come to a very nasty end indeed; Bilbo lives up to Gandalf's original opinion and earns the gratitude of the dwarves for his efforts.