The problem seems to be that 'null' is being inserted into the threadid column. As far as I can see, there are two possible reasons for this error:
Number 1 is line 292 that reads
Code:
$threadid = $dbh->{'mysql_insertid'};
is failing for some reason. mysql_insertid is a built in mysql function and returns the id of the last inserted record. I have no idea why this would not work on your setup. What version of Perl and MySQL are you using?
Number 2 is if the query on line 306 was pulling back null for the threadid column from the thread table. Now this is virtually impossible as threadid is an auto_increment column with a unique index on it.
I don't want to ask the obvious, but I will

you are installing this on version 1.15 or 1.114 right?
I'll need to do some more investigation. I'll get back to you.
As for the SQL instructions. I'm an Oracle DBA so I'm used to tablenames only being case sensitive if you put double quotes around them.

I will correct them asap.
regards