You probably can safely work for the new GC, but get a written contract with him to protect yourself, and make sure you get paid.
You could also ask for a clause in the new contract requiring the new contractor to "defend, protect, indeminify and hold you harmless from any claim,cost, cause of action or liability" to the former GC arising out of or in any way related to your signing the contract with the new GC.
This is NOT legal advice, just a general discussion of the law, as we are not familiar with the specific documents and facts of your case, etc. Please consult with a competent attorney in this area of the law for specific legal advice regarding your particular case, as the advice may vary depending on the facts.
The fired contractor has no right or ability to interfere with you continuing to work on the job.
As the other attorney answered, you should make sure you get a written agreement with the new contractor or enter into an agreement directly with the homeowner.