It looks like the webpart is just taking too long so the page is timing out. How long does it take on dev? 90 seconds or more?
Typically on a dev environment especially when debugging, the timeouts are adjusted to the max so that the page doesn't timeout while stepping through the code.
Maybe try adjusted the standard page timeout in your test environment and see if it helps. A value of 300 is equal to 5 minutes:
<httpRuntime maxRequestLength="51200" executionTimeout="300" />
Or you can try wrapping your code in an SPLongOperation msdn
You may need to set debug="false"
on <compilation />
tag in addition to <httpRuntime maxRequestLength="51200" executionTimeout="300" />
.
Based on where your page exists, you may also need to make same changes to web.config file in "_layouts" folder as well.