In this paper, we theoretically propose an optomechanical scheme to thermalize a two-dimensional photon gas in a hybrid optomechanical microcavity composed of a two-level atomic ensemble and a membrane oscillator enclosed in an optical cavity. The thermalization process is based on a phonon-induced asymmetry between the emission and the absorption rates of the atoms. We show that whenever this asymmetry obeys the detailed balance condition and if the photon lifetime is high enough, the steady-state photon number distribution matches the Bose-Einstein distribution. Furthermore, in order to study the effect of the optomechanical coupling on the Bose-Einstein condensation of photons, we calculate the critical photon number as a function of the temperature. We find that the optomechanically induced nonlinearity leads to the increase of the critical photon number, which can be controlled by tuning the optomechanical parameters.