This is an on going problem. It goes back to 10.5 at least. I have the problem where I have set the custom port to 30 and it switches to 25. On most users I have deleted the SMTP and created a newone setting port 30 from the start.
Heres a guess. The way my server is setup my router is traslating port 30-25 before passing it to the mail server. Could the mail servers responce be telling Mail to use 25?
Other locations where I have changed the mail server to port 30 don't seem to have as much of a problem.