preg_replace returns NULL if there's an error, so my guess would be that you're passing it something that's not a valid pattern.
You could try something like this (for testing only):
Code:
$ret = preg_replace($pat, $rep, $this->post['message']);
if ($ret !== NULL)
$this->post['message'] = $ret;
else
$this->post['message'] .= '<BR /><BR />Pattern error: ' . preg_last_error();