One aspect of this that hasn't been mentioned though is just fatigue. By analogy, if you were training in a gym for an hour and then decided to try to go for a heavy bench press, it might be harder and harder the more you try, since you are getting more tired.
But if you take a long lunch break or come back fresh the next day, it may be relatively easy.
So I think mental fatigue also plays into this. Although the other theories seem fairly established and more interesting.
But maybe you can extend the analogy further if you consider maxing out and then resting for a few days so that your muscles have made a slight adaptation (become slightly stronger). In this case, when you returned to the bench press, not only would your muscles be rested but also more capable.
This could be similar to the memory consolidation and organization that goes on during sleep which could provide an information schema that already incorporated key aspects of your problem and maybe previous similar problems/solutions, giving you a head start on solving it.
As an aside, it's interesting to think about how much work your memory is doing for problem solving with things like analogical reasoning. Which is one reason that it may be hard to measure intelligence accurately and fairly, since all skill and knowledge involves developing and accessing compressed problem/solution spaces.