Best or worst, best or worst? The book I think of as having the best AND the worst surprise ending is Stephen King’s The Dark Tower.
I remember waiting and waiting for that book, and reading it the day it was released, (same as the previous three in the series), and feeling surprised, confused, disappointed, and yet, somehow, perfectly accepting at the end. I also remember the uproar that followed among other readers, stating that we had been cheated out of a proper resolution. Part of me agreed–it felt like a cop out and a let down. Once I finished reeling, however, I realized that it made perfect sense. There was no other possible way it could have ended.
I hated that it ended the way it did. I wanted more resolution, more closure, so it was the worst. But King is very, very good at what he does, and everything fell into place, so it was the best.