The multi-wavelength spectrum observed from M87 extends from radio wavelengths up to TeV γ-ray energies. The radio through GeV components have been interpreted successfully using SSC models based on misaligned blazar jets, but the origin of the intense TeV emission detected during flares in 2004, 2005, and 2010 remains puzzling. It has been previously suggested that the TeV flares are produced when a relativistic proton jet originating in the core of M87 collides with a molecular cloud (or stellar atmosphere) located less than one parsec from the central black hole. We explore this scenario in detail here using a self-consistent model for the acceleration of relativistic protons in a shocked, two-fluid ADAF accretion disc. The relativistic protons accelerated in the disc escape to power the observed jet outflows. The distribution function for the jet protons is used to compute the TeV emission produced when the jet collides with a cloud or stellar atmosphere. The simulated broadband radiation spectrum includes radio, X-ray and GeV components generated via synchrotron, as well as TeV emission generated via the production and decay of muons, positrons and electrons. The self-consistency of the model is verified by computing the relativistic particle pressure using the distribution function, and comparing it with the relativistic particle pressure obtained from the hydrodynamical model. We demonstrate that the model is able to reproduce the multi-wavelength spectrum from M87 observed by VERITAS and HESS during the high-energy flares in 2004, 2005, and 2010.