Exact analysis as well as asymptotic analysis, based on large-deviation theory (LDT), are developed to compute the bit-error rate (BER) for ultrafast avalanche-photodiode (APD) based optical receivers assuming on-off keying and direct detection. The effects of intersymbol interference (ISI), resulting from the APD's stochastic avalanche buildup time, as well as the APD's dead space are both included in the analysis. ISI becomes a limiting factor as the transmission rate approaches the detector's bandwidth, in which case the bit duration becomes comparable to APD's avalanche buildup time. Further, the effect of dead space becomes significant in high-speed APDs that employ thin avalanche multiplication regions. While the exact BER analysis at the generality considered here has not been reported heretofore, the asymptotic analysis is a major generalization of that developed by Letaief and Sadowsky [IEEE Trans. Inform. Theory, vol. 38, 1992], in which the LDT was used to estimate the BER assuming APDs with an instantaneous response (negligible avalanche buildup time) and no dead space. These results are compared with those obtained using the common Gaussian approximation approach showing the inadequacy of the Guassian approximation when ISI noise has strong presence.