what if mtgox identifies the invalid transfers and all of the miners decide to rewrite the blockchain invalidating those transactions, so that mtgox gets their money back?
It depends. If the bitcoins were stolen and then spent you can't get them back. Still if Gox can produce all relevant transaction information it shouldn't be too difficult to verify their theft claim. However if say they've lost the wallet key, then there is a feasible recourse for that.