Note that the user agent header cannot be trusted, as it is easily spoofed or modified (for legitimate purposes) by the user (in fact, I think either Opera or Safari routinely "disguises" itself as IE for some reason). It can certainly be used for information purposes, just don't become dependent upon it for any critical purposes.
I find that generally, if your mark-up and CSS is valid (including a fully qualified doctype declaration to get IE out of "quirks mode"), I seldom have any problem getting Firefox and IE to display the same, the exceptions usually being when I try to do something really complicated or unusual. If you stop thinking in grids (which table-based layouts got everyone thinking as) and start thinking in terms of columns, life will be much easier. 🙂