In several manufacturing contexts including food industry, semiconductor manufacturing, and polymers forming, the product quality deteriorates during production by prolonged exposure to the air caused by excessive lead times. Buffers increase the system throughput while also increasing the production lead time, consequently affecting the product quality. This paper proposes a theory and methodology to predict the lead time distribution in multi-stage manufacturing systems with unreliable machines. The method allows to optimally set inventory levels to achieve target production quality performance in these systems. The industrial benefits are demonstrated in a real manufacturing system producing micro-catheters for medical applications.