Chosen Solution
I have an iPhone 5 used for fun, not a daily driver. The power button only intermittently works. When it does work, it only works pressed in very specific ways. Is this more likely to be a power button issue or a board issue?
If I’m pondering a problem with any kind of machinery as to whether it’s electronic or mechanical, I tend to look toward the mechanical parts first. Anything that moves is going to eventually wear out no matter how well designed. Electronics, on the other hand, just move electrons from one place to another, so with no moving parts, it’s going to take a lot longer to wear out. In your case, when you press the power button you’re pressing a physical switch that moves and connects two electrical points. So at this point you’re simply completing a circuit that makes a round trip to the circuit board via a flex cable. If the switch gets contaminated or the contacts wear then its operation can easily become intermittent as you describe. So the good news is you can buy a new switch here at iFixit for only about $5 USD. iPhone 5 Audio Control and Power Button Cable - iFixit Store You can also get the part packaged with the tools you need to do the job for about $10 USD. The bad news is that it’s one of those pain-in-the-a$$ repairs that make you ponder long and hard whether it’s worth it or not. You have to open up the case, take out the battery and motherboard and just generally take a whole bunch of stuff apart to get to that cable with the switch mounted on it. There is a guide for it, though, so that’s something. iPhone 5 Audio Control and Power Button Cable Replacement - iFixit Repair Guide Good luck, let us know how it goes!