Welcome to dependency hell...
The question is "How to upgrade gcc?"
If you are running any linux that uses a package manager [ redhat,
debian, etc.] the "right" way to upgrade is to use the package manager,
which will deal with all the dependencies. It is not atypical to find
that upgrading one package impacts several others. Sometimes, just
rebuilding those packages from source is enough, other times it may not
be worth the bother.
An Alternative is to install an upgraded package in another place and
then deal with the "path" issues. This is what I did with gcc-4.1.0.
As for resolving your firefox problem, you may have to rebuild it from
source in your modified environment.
-Joseph
...