You can't generate 5000 thumbnails at once for sure with a shared account. It will be too much.
The best would be to generate them on your computer and upload them I know I can do that with other scripts than gallery2.
Otherwise you will have to generate thumbnails by group. I mean 20 by 20 for example.
Ok maybe better if you can't do the first solution, install all locally on your computer with easyphp, generate the thumbnails and then upload all on your real server.
Thanks so much for your answer. It clear my doubt. By the way, which graphic toolkits is better, PHP GD, ImageMagick or NetBPM ? And does Lunarpages have them ?