In the standard fireball model of gamma-ray bursts (GRBs), the fireball starts with an optically thick phase. As it expands, the fireball becomes optically thin at some stage. The thermal radiation trapped in the originally opaque fireball then leaks out, producing a transient event. The appearance of the event is investigated in the framework of a homogeneous, spherically symmetric and freely expanding fireball produced instantly by an explosive process without continuous injection of mass and energy. We find that, generally, the event has a time duration shorter than that of the main burst, which is presumably produced by the internal shock after the fireball becomes optically thin. The event is separated from the main burst by a quiescent time interval, and is weaker than the main burst at least in a high-energy band. Hence, the event corresponds to a GRB precursor. The precursor event predicted by our model has a smooth and Fast Rise and Exponential Decay (FRED) shaped light curve, and a quasi-thermal spectrum. Typically, the characteristic blackbody photon energy is in the X-ray band. However, if the distortion of the blackbody spectrum by electron scattering is considered, the characteristic photon energy could be boosted to the gamma-ray band. Our model may explain a class of observed GRB precursors - those having smooth and FRED-shaped light curves and quasi-thermal spectra.