"sometimes mIRC joins another server for some weird reason first"
Maybe you have try next server in group option turned on, and mIRC can't connect to that particular server, so it tries the next in group.
Options / Connect / Options / Retry, and uncheck the "[] Try next server in group" option