I deleted the question because it looked completely abandoned to me. There were a bunch of noisy comments that no one had bothered to clean up after many years until I got an automatic flag about it. From a cursory glance at the comments, not to mention the elapsed time, it seemed like you did not yet have a clear, answerable question and were using the comments as a means to refine your question. That's a reasonable escape hatch, but it had been several years and nothing seemed to have come of it. Little to none of the discussion from the comments had been incorporated back into the question itself, and the question had received no real answers, so it looked like a dead question—something that was not adding any value to the community, and something that an automatic process routinely deletes anyway.
Worse than just not adding any value, though, it actually looked to me like the question was doing harm because it was attracting bad answers based on invalid information presented in the question. You yourself flagged the answer for that reason, and asked that it be deleted because it was "just a misunderstanding due to wrong citation".
I looked at the question, saw that you had corrected a typo in the most recent revision, and figured that after all the extended discussion in the comments, your problem had been solved some time ago—you'd simply failed to update the question to reflect it.
A question that is attracting confusion, extensive discussion in the comments, and bad answers is a prime candidate for deletion. So, for all of those reasons, instead of just deleting the answer you had flagged, I blew away the whole thing. The thinking was, essentially, why address the symptom when you can address the problem?
Aside from that, I kind of felt like it would be dirty pool to delete someone's honest attempt at an answer because you had an error in the question, no matter how simple the error seemed. They looked at the code in the question, saw it was wrong, and posted an answer that fixed it. The comment discussion on that answer was fast becoming hostile for precisely that reason—you telling them their answer was useless because it was based on a misunderstanding, and them not understanding why you should be able to change the code in the question out from underneath them. I didn't really understand that either.
That said, I'm open to the possibility that the question should not have been deleted. If you really have not yet solved the problem, and you can update the question so it is more clear to everyone (so it won't attract a bunch of noisy comments and unhelpful answers), then I would be happy to restore it.
Or you can start over and ask a new question, without any of the baggage of the past. Up to you.