Checking the logs (/var/log) is a good start.
Hunting some existing bug reports describing your situation might be a good idea too. In case of ubuntu, head to the launchpad.
If the problem occurs when a specific program is used, it might be interesting to launch it from the command line to see if it outputs some errors or warning.
You can also launch this program with
strace to check if a system call goes wrong.
You might try to find the minimal situation that can reproduce your bug.
When confronted to random bugs, the first things to check are your RAM (
memtest86+) and your hard disk (
e2fsck). You might want to also check your system resources (