The Expected Discounted Penalty Function (EDPF) was introduced in a series of now classical papers. Motivated by applications in option pricing and risk management, and inspired by recent developments in fluctuation theory for Lévy processes, we study an extended definition of the expected discounted penalty function that takes into account a new ruin-related random variable. In addition to the surplus before ruin and deficit at ruin, we extend the EDPF to include the surplus at the last minimum before ruin. We provide an expression for the generalized EDPF in terms of convolutions in a setting involving a subordinator and a spectrally negative Lévy process. Some expressions for the classical EDPF are recovered as special cases of the generalized EDPF.