In this paper, a virtual sensor for the estimation of the injected pilot mass in-cycle is proposed. The method provides an early estimation of the pilot mass before its combustion is finished. Furthermore, the virtual sensor can estimate pilot masses also when its combustion is incomplete. The pilot mass estimation is conducted by comparing the calculated heat release from in-cylinder pressure measurements to a model of the vaporization delay, ignition delay and the combustion dynamics. A new statistical approach is acquainted for the detection of the start of vaporization and the start of combustion. The discrete estimations, obtained at the start of vaporization and the start of combustion, are optimally combined and integrated in a Kalman Filter that estimates the pilot mass during the vaporization and combustion. The virtual sensor was programmed in a FPGA and its performance tested in a Scania D13 Diesel engine. The experimental results showed that the method can effectively improve the in-cycle pilot mass estimation. The accuracy, quantified by the average error between the actual injected mass and the estimated mass, was improved from an induced initial bias error of ±3mg/st to a final error of ±0.1mg/st, with a precision of ±0.45mg/st. A precision of ±0.5mg/st was already obtained at the peak of the pilot heat release. The suggested method is robust against changing operating conditions out of the calibration points. With the proposed parametrization, this is limited to regions where the parameter change is linear. The maximum calibration bias error for points out of the calibration range was within ±0.5mg/st, with a precision of ±0.8mg/st. In addition, the method was found to be robust against most input measurement errors and parameter bias. The major error sensitivity was detected for intake pressure error and TDC offset. Different fuels than the used for calibration was found to result in a proportional error to the low heating value error. The estimation framework can easily integrate more complex models to allow the estimation of bigger pilot masses and multiple injections. The pilot mass estimation can be used to predict the pilot combustion and its effect on the main injection. This allows for better in-cycle controllability i.e. be able to adjust the main injection timing and duration, cycle-to-cycle control and adaptation of pilot and main injections. The close-loop control of the combustion enables improved engine performance and efficiency, and increased emissions margins.