I have been experiencing this problem as well. I have some 8,000 songs in my library and just shuffled it once and allow the player to pick songs for me. Sometimes I have to skip several dozen songs because it plays the same songs I listened to before.
Now, this gets a bit speculative, but I noticed that if I pause the player briefly, it will pick up where it left off -- even when "briefly" means several hours. Thus I am speculating that the bug happens when you switch applications. Leave the player on, maybe answer a couple of phone calls, and you should be fine. Use other apps, and the music player will jump back to the last place when you resumed it under controlled conditiojns. I hope others can confirm or refute this finding, as I have a real job to take care of too.
This also suggests a workaround; when you stop listening, pause the player, but then press play again, and pause again. If that works, you should be able to pick up from the first pause when you resume listening.
I found that it's purely due to when the Music app gets removed from memory to save power.
If I leave my phone plugged in or in airplane mode with a full charge, it will remember its position all night. If the battery is down to 20%, it loses its place in a few minutes.
It's a clear violation of their own guidlines: