A search for narrow resonances decaying to an electron and a muon is presented. The e mu 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 mu 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 a tau sneutrino in R-parity violating supersymmetry is considered. The t sneutrino is excluded for masses below 1.28 TeV for couplings lambda(132) = lambda(231) = lambda(')(311) = 0.01, and below 2.30 TeV for lambda(132) = lambda(231) = 0.07 and lambda(')(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 mu mass spectrum excludes QBH production below a threshold mass M-th 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 mu final state.