I feel for you, but I guess you had taken the greater road of selling the car now.
I believe I am in the same sort of situation as you. A lemon X5. My car has spent the last 2 month at the dealer. I had the car for almost 3 year now, and half the time it's been at the dealers trying to sort out the problem(i have a stack of service paper).
The more they temper with, the more problem it seems to get. I experience almost every problem a X5 can come up with. But the mechanics at BMW seem to have no idea on how to fix it. Asks the same question over and over again, and saying that they can't duplicate the problem. And yet, every time I get the car back, the problem reappears the next day.
I believe you done the right thing by changing to a new vehicle. Good luck
note: 1 qs, the engine detonation you had experienced. Is it a sudden loss in stepping the acclerator, loss of power? And a loud bang?