The second sentence is correct. "I wish it didn't come to this" has a meaning of, "It comes to this [present tense], but I wish that it didn't." To refer to things that happened in the past, "to wish" is followed by the past perfect tense: "I wish it hadn't come to this." That is, "It came to this [simple past tense], but I wish it hadn't [past perfect tense]."
I hope that this helps!