I'd say bug count is a measure of good quality code, but it's more of a reflection of bad code than the definition of bad code itself. Keeping the cyclomatic complexity low, and the organization of your code high, you can reduce the number of bugs in your application. I've seen some code that's ridiculous spaghetti code, but somehow has no apparent bugs. That's great and all, but it's a nightmare to maintain.
It's sort of the difference between using good writing style, and having a good plot that has no holes. You can have an excellent, enthralling writing style, but if your plot is full of holes, your book sucks. On the other hand, you could have the best plot on the face of the planet, but if your wording is too difficult to understand and your writing style is boring, you've not written a good book.
They tend to be correlated, but one is more causally correlated. Bad code often leads to bugs, not the other way around.