The investment Microsoft famously made in Apple in 1997 did not prevent Apple from going bankrupt. By the time the money was in Apple's accounts, its fortunes were already reversed.
The fact Microsoft announced they were investing, and that they were committed to continue shipping Office to Mac, definitely helped.
If by biggest rival you mean Microsoft, it was Microsoft who saved Apple from bancrupcy in 1997.