You should really do this server side and not software side... You need to either load balance better, or improve the server.
The problem with this is that there will still be pings to the server regardless of if there is a limit. It may simply change the image, but you're still getting the hits.
Spread your site over multiple servers using CDN, external hosting, and potentially a secondary server for SQL and you should have no issue.