Can a faulty power cord cause a compter to power down at random?

I ask because I think that's what's behind my computer powering itself off from the main desktop today.
Order of events:

- Go to turn on my computer, sees its not powering on after pressing the button.
- No problem, this has happened before, but not for a few months. Reaches back and pushes the power cable back in/ move the wire a little until I can turn the PC on.
-Pc turns on. Clicks the proper user, desktop appears, nothing unusual.
- Walks away for about 10ish seconds, comes back to see the computer powered off with the monitor saying what it usually does when I manually power down the PC.
- I turn if back on and it's been working for the past hour. Nothing in the event viewer, no mini dumps, Already set to not auto reboot on BSOD.

I just want to first see if the events that happened can possibly/likely be the cause of said power cord before I go any deeper to figure out the cause of the reboot. If there is anything you need to know or which I should check because it probably wasn't the power cord giving my PC the power it needs, please don't hesitate to post.
 
If the desktop computer's power cord was conically loose, an electric spark between the power cord and the power supply, could have eventually damaged the power supply or even the motherboard...
 
Back