I'm guessing this is due to a server variable setting (in your php.ini) restricting the script a maximum time to run or maximum memory usage (like RAM). You should talk to your webhost about how you can increase the max_execution_time and memory_limit variables on your site. Hopefully that will fix the thumbnail generation issues.