In one of Peter Jackson's Hobbit movies, I think The Desolation of Smaug, there is a flashback scene showing Gandalf meeting with Thorin at the Prancing Pony in Bree. Gandalf convinces Thorin to try to take back The Lonely Mountain, leading to the events of the movies. I am certain this was not in Tolkien's The Hobbit book. Was this meeting described somewhere else in Tolkien's books or was it one of Jackson's inventions for the film?
Yes, this is in Appendix A1. It's too long to quote in its entirety, but these passages should be sufficient to prove it:
[A]t last there came about by chance a meeting between Gandalf and Thorin that changed all the fortunes of the House of Durin, and led to other and greater ends beside. On a time Thorin, returning west from a journey, stayed at Bree for the night. There Gandalf was also. He was on his way to the Shire.
It was even as Gandalf sat and pondered [Smaug and his relation to Sauron] that Thorin stood before him, and said: 'Master Gandalf, I know you only by sight, but now I should be glad to speak with you. For you have often come into my thoughts of late, as if I were bidden to seek you. Indeed I should have done so, if I had known where to find you.'
The story is told elsewhere of what came of that meeting: of the strange plan that Gandalf made for the help of Thorin, and how Thorin and his companions set out from the Shire on the quest of the Lonely Mountain that came to great ends unforeseen. Here only those things are recalled that directly concern Durin's Folk.
Return of the King Appendix A: "Annals of the Kings and Rulers* III "Durin's Folk"
Needless to say Jackson took some liberties with the precise sequence of events, but the meeting itself was indeed taken from Tolkien's writings.
1 As Lexible reminds me in comments, a more complete version of this story, told from Gandalf's perspective, is included in Unfinished Tales. I won't say anything more about it here because Jackson wasn't legally able to incorporate anything from that text into his films. But it's there if you're interested, though it bears little similarity to the film version.
In the Director's commentary, Peter Jackson and Phillipa Boyens talk about the opening sequence of the Desolation of Smaug, specifically noting that Thorin's meeting with Gandalf does exist within Tolkien's writings (albeit in Appendix A of RotK rather than in 'The Hobbit') and also why they chose to include it at this point in the film sequence (e.g. to bring viewers back into the story)
PJ: This is a scene, this Bree is quite an iconic scene in the book, not the Hobbit book, but in the Appendices of the Lord of the Rings, yeah, but it does cover the moment that Gandalf and Thorin encounter each other in Bree and it was a scene that we always wanted to put into the movie and we wrote it into the script and we took it out and we wrote it in again
PB: Guillermo [Del Toro] did a version.
PJ: Guillermo had it in a version of his script and ah, it eventually it didn't make it into the script when we didn't film it, but then when we went into the three movie scenario and we needed an opening and we thought of this as being an "economical" way, economical meaning that it's like nice and doesn't take much storytelling to really get everyone on the same page again.