A heat engine undergoes a cyclic operation while in equilibrium with the net result of conversion of heat into work. Quantum effects such as superposition of states can improve an engine's efficiency by breaking detailed balance, but this improvement comes at a cost due to excess entropy generated from collapse of superpositions on measurement. We quantify these competing facets for a quantum ratchet composed of an ensemble of pairs of interacting two-level atoms. We suggest that the measurement postulate of quantum mechanics is intricately connected to the second law of thermodynamics. More precisely, if quantum collapse is not inherently random, then the second law of thermodynamics can be violated. Our results challenge the conventional approach of simply quantifying quantum correlations as a thermodynamic work deficit.