I was recently plagued by the “An unexpected error has occurred” page on SharePoint 2007 (WSS v3), and was delighted to find some people have posted how to disable the custom errors page, and enable callstack. Be sure to do this on all of your dev and test platforms!
To paraphrase all the articles on the topic...
Edit your virtual directory's web.config
Find the "<SafeMode" line and set:
CallStack=“true“
AllowPageLevelTrace="true"
(Note: most articles on this topic just mention setting CallStack. Some articles mention setting AllowPageLevelTrace, saying that it provides "more information")
Find the "<customErrors" line and set:
mode=“Off“
(referenced http://blog.thekid.me.uk/archive/2007/02/15/a-solution-to-quot-an-unexpected-error-has-occurred-quot-in-wss-v3.aspx)