Also note that if you're using Memtest86 it isn't completely foolproof. I've had Memtest run all day long on my computer, but still having Prime95 turn up some memory errors.
Prime95 is in fact an excellent way to determine if your memory or CPU is causing trouble. It has a few different modes that makes it use most of your memory (memory test) or mostly CPU cache (CPU test). If for instance the memory test fails, but the CPU test doesn't, you know the memory is bad. If both fail, it's probably the CPU. A properly stable computer should be able to run either of these tests for at least 6 hours, ideally indefinitely.