Well first issue is it appears to be version UBB.threads 7.2.2.
Released August 28, 2007
That is a extremely old version with many past bugs and security risks that have been resolved.
The current version is UBB.threads 7.5.8.
Released November 29, 2013.
15 versions later.
So your first post may in fact be the issue and you were hacked.
Someone probably needs to do a lot of housekeeping with the scripts and database clean it up back to ubb7.2.2 and then upgrade so it does not happen again.
Sorry for the bad news.