First of all, take a look on this thread, it's a nice discussion:
I don't believe Quantum Computing will ever threaten Bitcoin.
As far as I know, if a quantum computer so strong as we imagine it gets created from some organization tomorrow, it will be a threat to bitcoin mainly for the public key part. There are already people that try to find a way to reverse a public key back to its private key and I can see that they've done some
good work behind all these advanced maths that I don't understand. So, since someone makes a transaction and his public key is known, he
may be in danger from such attack. Reversing a public key is "possible", but currently
is infeasible. I guess that that's the big problem that bitcoin will face from a quantum computer. It can be faced really easily, though. Once you make a transaction send the rest of the money to a non-used address you own.
The other catastrophic theory is that a quantum computer can brute force a sha256 result. I don't know if that'll be true. I hope not. Otherwise, bitcoin is dead. As for the 51% attack, I wouldn't worry. Even if it happens, it will be something temporary. Sooner or later, the computer will spread to the rest of the world.