Emission spectra of quantum dot arrays in zero-dimensional microcavities are studied theoretically, and it is shown that they are determined by the competition between the formation of the collective superradiant mode and inhomogeneous broadening. The random sources method for the calculation of photoluminescence spectra under a non-resonant pumping is developed, and a microscopic justification of the random sources method within a framework of the standard diagram technique is given. The emission spectra of a microcavity are analyzed with allowance for the spread of exciton states energies caused by an inhomogeneous distribution of quantum dots and a tunneling between them. It is demonstrated that in the case of a strong tunneling coupling the luminescence spectra are sensitive to the geometric positions of the dots, and the collective mode can, under certain conditions, be stabilized by the random tunnel junctions.