We investigate by first-principles simulations the resonant electron-transfer lifetime from the excited state of an organic adsorbate to a semiconductor surface, namely isonicotinic acid on rutile TiO$_2$(110). The molecule-substrate interaction is described using density functional theory, while the effect of a truly semi-infinite substrate is taken into account by Greens function techniques. Excitonic effects due to the presence of core-excited atoms in the molecule are shown to be instrumental to understand the electron-transfer times measured using the so-called core-hole-clock technique. In particular, for the isonicotinic acid on TiO$_2$(110), we find that the charge injection from the LUMO is quenched since this state lies within the substrate band gap. We compute the resonant charge-transfer times from LUMO+1 and LUMO+2, and systematically investigate the dependence of the elastic lifetimes of these states on the alignment among adsorbate and substrate states.