Is it safe and secure to use iOS 3.1.3 ?
I have heard of no exploits that can affect non-jailbroken iPhones regardless of the version of iOS. While iOS 3.x is no longer being updated, there should be no reason to worry. A second-generation iPod touch can run up to iOS 4.2.1, though.
And are you able to use the latest version of the facebook app on this iOS?
No. As the Requirements for the Facebook app in the iTunes Store state, it requires iOS 4.0 or later.
Early iOS like 3.1.3 are open to at least one attack. That is the one used by the site that allowed jailbreaking by just taping the Jailbreak Me button on a website. See: