Hi Burney,
It could be a number of things but before saying the most expensive solution. Try this first loosen gear box mount and wiggle it around then tighten, I have heard this sometimes resolves the issue. Failing that take the gear lever out and check the the saddle (black or white plastic) at the end of the lever is not worn, straight edges etc. If the gear lever is loose most of the time this could be an issue.
I have also heard old oil/low oil can cause this problem.
Also quick thought has the lever been adjusted to quick shift, if not the right length it will pop out.
With some careful clutch control and a downhill slope you can manually select 5th with the lever off with a big screwdriver and drive off, if it still pops out after this I would suggest the box needs some new internal parts.