I would keep the answer for historical reasons. But ONLY if the question can still be answered or debugged with the answer as it exists. If the answer as it is is completely wrong and will not help in the slightest, though, I would mark it as Not an Answer and remove it.
I do this sometimes with a quote block as follows, though I usually do this for my own answers which I replace with a different answer:
This answer no longer answers the question in its current state, but has not been edited or removed yet for historical reasons, in the event that it may help someone else. It may, however, be deleted at any time in the future.
Code for this:
> This answer no longer answers the question in its current state, but has not been edited or removed yet for historical reasons, in the event that it may help someone else. It may, however, be deleted at any time in the future.