It's actually a loop that goes over the regexes that I'm not exactly sure why it's there.

Editing ubbthreads.inc.php seems to fix this. Around line 988 of that file there is a block of code that looks like this:
Code
while( $x && ( $loop < 10 ) ) {
     $loop++;
     foreach( $regexes as $z ) {
          if( preg_match( $z[0], $body ) ) { 
               $x++;
               $body = preg_replace( $z[0], $z[1], $body );
          }
     }
} // end while

We need to comment out the loop, like this:

Code
//while( $x && ( $loop < 10 ) ) {
     // $loop++;
     foreach( $regexes as $z ) {
          if( preg_match( $z[0], $body ) ) { 
               $x++;
               $body = preg_replace( $z[0], $z[1], $body );
          }
     }
//} // end while