A search for narrow resonances decaying to an electron and a muon is presented. The eμ mass spectrum is also investigated for non-resonant contributions from the production of quantum black holes (QBHs). The analysis is performed using data corresponding to an integrated luminosity of 19.7 fb-1 collected in proton-proton collisions at a centre-of-mass energy of 8 TeV with the CMS detector at the LHC. With no evidence for physics beyond the standard model in the invariant mass spectrum of selected eμ pairs, upper limits are set at 95 % confidence level on the product of cross section and branching fraction for signals arising in theories with charged lepton flavour violation. In the search for narrow resonances, the resonant production of τ sneutrino in R-parity violating supersymmetry is considered. The τ sneutrino is excluded for masses below 1.28 TeV for couplings λ132= λ231= λ311 ′= 0.01 , and below 2.30 TeV for λ132= λ231= 0.07 and λ311 ′= 0.11. These are the most stringent limits to date from direct searches at high-energy colliders. In addition, the resonance searches are interpreted in terms of a model with heavy partners of the Z boson and the photon. In a framework of TeV-scale quantum gravity based on a renormalization of Newton’s constant, the search for non-resonant contributions to the eμ mass spectrum excludes QBH production below a threshold mass Mth of 1.99 TeV. In models that invoke extra dimensions, the bounds range from 2.36 TeV for one extra dimension to 3.63 TeV for six extra dimensions. This is the first search for QBHs decaying into the eμ final state.