Just in case anybody else runs into this problem:

I wrote some custom form code that had an edit parameter that took an id e.g. mysite.com/form?edit=14.

When I submitted the form, it would redirect to mysite.com/1 no matter what I set for #redirect or returned from the submit function. This was driving me crazy until I actually looked at the drupal_goto code in includes/common.inc.

The reason is because the code that looks for a 'destination' parameter also looks for an ['edit']['destination'] parameter. I'm not sure exactly why this is, but it probably has to do with the way urls are packed an unpacked in the node/1/edit type pages. Anyway, it completely screws up redirects, making them redirect (in my case, at least) to the base url plus the first letter of the 'edit' variable!

I renamed my ?edit= parameter to ?ed= and now everything works fine.

Moral of the story: read the source code. You're never going to guess what weird special cases might exist :)