Or, if there is a phpbb on your server anywhere that has been infected by the worm, it used that as a way to get to any writeable php file on your server, including some of your UBB.threads files.
You can reinstall your UBB.threads, but until/unless you find the files that the worm used to enter your server it'll just happen again.
http://searchsecurity.techtarget.com/originalContent/0,289142,sid14_gci1036174,00.html
You'll need to update your php then find/remove/update that phpbb.
Your UBB.threads was an innocent victim.