Glad you got it sorted. Have seen others with similar issues (deleting a course module - which was a quiz). Not really discovered as to cause .. will probably never know! :|
Since this involves DB, am wondering if it has anything to do with DB character set and collation + using InnoDB?
There are some scripts in code/admin/cli/ I suggest you run to see if there are any issues with the restored DB.
Run all the scripts that begin with mysql_ to see.
'SoS', Ken