One of the numbers I keep track of while working on the Optimizer project is the number of outstanding issues logged against it. We really try hard to ensure that each version of Optimizer is released with an empty bug database. The reason is simple. During a previous coding gig, I calculated that each bug, on average cost about $350 to fix. To come up with that number, I added the salaries of the programmers dedicated to fixing bugs together and divided by the number of bugs they fixed over a year. One of the products had plenty of issues so the getting supporting data was not hard to come by. I didn't factor in overhead costs or the amount of free juice they consumed. $350 represents the average cost in terms of straight salary. Obviously if we discover bugs before our customers do, the cost is less. If we can automatically find bugs by writing good quality unit tests, or keep bugs from getting into the product in the first place, the cost is much less.
The cost of quality is not negligible and must be taken into consideration when planning projects. Adequate time for doing proper design, writing unit tests, and performing user acceptance testing must be budgeted for. Having said that, I would argue that the cost of quality is often less than we think. An awesome side effect of higher initial quality is that our developers get to spend their time adding new functionality to the product which has a positive impact on the morale of the development team (who doesn't like doing new development), not to mention happier support staff (fewer issues to deal with) and very happy customers (feature packed releases that help them do their jobs better).