I have had a similar issue with my iphone 5. I had previously replaced my rear housing. I must have damaged the battery upon removal, it was very well stuck. The symptoms were randomly shutting down perhaps due to the battery playing up. It would read a certain percentage for half an hour and than drop by 25% and than die.
I decided that the battery must have been damaged, I replaced it with a new one from ebay and everything worked well. I even had 30% battery at the end of the day. Goes to show the capacity drops a lot over a year.
Here is where I get to a similar issue as is brought up in this post. I put my phone in my pocket facing down and when I pull it out.. It's dead. Turn it on and everything's fine. Hang it upside down its flat..
I shook my phone a little and noticed that something, most likely the battery was moving around in there! I would guess that in the down facing position it touches against something it shouldn't or tha perhaps the movement causes that battery to stop feeding power to the mainboard. My solution has been to use double sides tape to hold the battery still.
I hope this is helpful, if that doesn't work try a new battery. Seems they cause a lot of issues in the i5.
Good luck