I'm ASSUMING , you hit near 100C, that is your cpus max temp.
It really should be able to run 24/7 at 100% and stay around 80C. I do this with mine as I run folding at home, and so it runs 100% 24/7 and it's been that way for over a year.
While the temp might not be your shutdown issue, you do have a problem, though I'm thinking it is because you have a crappy case for air flow.
If you can not run prime for at least an hour with out your temp going over 95C you need to think about getting a new case for the parts. Liquid cooling like a Corsair will be wasted money.
What memory test are you doing? Memtest is the best as it is a bootable program that RUNS LINUX and can test everything.
Memtest86+ - Advanced Memory Diagnostic Tool
I think you may be correct it is not a heat problem but you do have a problem with heat.