It drives me up the wall every time it happens as well, but no problem!
Looking at the underside of the strimmer, there's a plastic ring around the strimmer cap. Hold on to this with thumb and index finger (you can even pull it towards you slightly), whilst at the same time turn the strimmer cap anti-clockwise (you can push down on the strimmer cap a little to help ease it out). The strimmer cap then comes off, as it has three tabs that locate behind housings in the plastic ring.
You then just find the end, pass it through the hole in the strimmer cap again and push the strimmer cap down over the small cord drum (If you partially truck the cord into one of the slits in the cord drum, the strimmer cap will push back on again a bit easier.)
Then it's the reverse of the above to locate the strimmer cap again - push down and turn the strimmer cap clockwise, hold and pull up the plastic ring. The tabs locate underneath the housings in the plastic ring again.
To avoid it not happening so much, don't let the cord get too short (Feed out as you go along by tapping the strimmer cap on the ground.) and try to avoid solid objects!
Jim, May 2008