Considering all that's been said...and what the topic of the thread is...
I say that Frodo said it not because he needed the hope, but because he knew what Gollum had been through and new a fragment of what he was still going through. He'd born the ring for some time by then and wasn't completely ignorant.
He didn't have hope. He may have needed hope, but the hope that Gollum would come back certainly wasn't exactly what he needed.
And, speaking more from the book than from the movie because the book showed it better, I think that Frodo wasn't doing it for himself, but for everyone and everything else. He didn't believe that he was going to be making it back.
He saw in Gollum a trapped mind and soul, like a slave, in fetters that can't be unlocked with a mere key. His character, being a hobbit, and having been happy at one time, and free, too, but now being under the same sort of bondage (though not exactly the same, or not to the same extent), he just hated to see Gollum like that. He wasn't afraid that Sam would stop loving him. I don't even believe that he was afraid that he was going to turn into something like Gollum. He just hated to see the bondage and he wanted him free.