Have you made any change to your site in the last few days? Changed permissions, upgraded or edited any files? "World-writable" directories and files (777 or 666 permissions) can trigger a 500 error. Bad file editing (introducing blank lines at the beginning or end) or a bad upload (binary instead of ASCII mode) can trigger a 500 error for a script.
You might want to open a ticket with support and ask if there were any changes on your server around that time, such as a move or software upgrade (PHP, MySQL, Perl). Did LP turn off PHP's register global variables on your server at that time? What is "gallery.cgi" written in? Perl? Did you upgrade a standard (e.g., Fantastico) script?
Do you have a full directory listing (file names, sizes, dates) from when it was working, to compare against what's there now and see if a hacker might have gotten in and changed something? Take a listing now and see if any files don't look familiar, or have suspiciously recent timestamps.
Don't worry about the 404 error. The server is telling you that it went looking for an error document for 500 (e.g., /500.shtml) and found nothing (a 404 result).
I still can view my gallery from the day before yesterday...I don't remember if I changed anything, but I guess I didn't except uploaded a gif picture to other direction.
Yesterday I logged in to ftp and found that my gallery.cgi changed to permission 0. I reseted it but it didn't work anyway. So I uploaded and recovered the original cgi but it still doesn't work...
It worked fine 2 days ago...
BTW, I don't see any suspicious files...