There's actually an easy way to fix this. You're getting the error after approximately 1 minute right? The SQL command is timing out. There's a reg key that can be set to change the timeout value.
Since I can't find the KB on RIM's web site, I'll give a workaround first and keep searching. Use osql (or Query analizer if you're using SQL) and run the database maintenance manually. The command for this is
exec removeoldworkqueue 15
This will remove any old/stale items that are stuck in the workqueue that are older than 15 days
See this KB for more info on the database maintenance Livelink - Redirection
This generally does clean up enough items that the SQL script no longer times out.
Once I find the reg key for the timeout value, I'll edit this post.
I couldn't find the KB on it, but I did find the reg key
Location: HKEY_LOCAL_MACHINE\Software\Research In Motion\BlackBerry Enterprise Server\Database\ Name: QueryTimeOutODBC
Value: 60 (Decimal)
You may need to increase the value to 180 or higher in some cases.
The value is the timeout in seconds.