I think that Bilbo felt for Gollum. The dwarves and the goblins hated certain beings. Still they all belonged to a group or collective Middle Earth "ethnicity". Gollum was alone:he had nobody to even collictively hate him. Bilbo was tired of the feuds and prejudice. He wanted to purge his own prejudice, he let Gollum live.