True, Nokia was in trouble well before the WinPho fiasco, but Symbian was just a sympton rather than the disease. Management had allowed the company to branch off into different product lines and encouraged competition between them with apparently little fiscal oversight and paying no attention to the third-party developer community. So, they had S40 engineers working on almost-smartphone handsets to challenge low-end S60/Symbian handsets, S60 engineers trying to widen their product range, and Maemo/MeeGo engineers trying and failing to prove that their otherwise unwanted bastard child was a much better platform. While the managers had their heads firmly esconced in their rectums, Elop took advantage of their indecision and gave them a false sense of hope.
Or, maybe not. There's a theory out there that Nokia management knew that they had a shit sandwich on their hands before Elop came along, and sought a way to wipe the slate clean without taking the blame directly if things went wrong. Microsoft and Elop appeared at the right time with an offer that they would happily not refuse: take a large amount of money in exchange for them taking out the trash for you, money that you'll be able to use to restart your phone business from the ground up in a relatively short time frame.