On a positive note the fact that it occasionally works indicates a likely intermittent contact issue; often they work when things heat up and metal expands or when you wiggle or jiggle a part or connection.
So reseat EVERYTHING and if it is not shiny use a fine emery board to get rid of oxidation; I use an eraser on gold card connectors. For things like cables that feel loose, use a fine set of needle nose pliers to tighten Molex pins and such. There is also sold through cyberguys a Deoxit spray to improve contact.
With patience and changing one thing at a time you might ne able to define what is at issue -- not likely you CPU from your scenario, so look to the motherboard and connections there