We demonstrate single-shot detection of single electrons generated by single photons using an electrically tunable quantum dot and a quantum point contact charge detector. By tuning the quantum dot in a Coulomb blockade before the photoexcitation, we observe the trapping and subsequent resetting of single photogenerated electrons. The photogenerated electrons can be stored in the dot for a tunable time range from shorter to longer than the spin-flip time T1. We combine this trap-reset technique with spin-dependent tunneling under magnetic fields to observe the spin-dependent photon detection within the T1.