We revisit the paradigm of an ideal gas under isothermal conditions. A moving piston performs work on an ideal gas in a container that is strongly coupled to a heat reservoir. The thermal coupling is modeled by stochastic scattering at the boundaries. In contrast to recent studies of an adiabatic ideal gas with a piston [R.C. Lua and A.Y. Grosberg, J. Phys. Chem. B 109, 6805 (2005); I. Bena, Europhys. Lett. 71, 879 (2005)], the container and piston stay in contact with the heat bath during the work process. Under this condition the heat reservoir as well as the system depend on the work parameter lambda and microscopic reversibility is broken for a moving piston. Our model is thus not included in the class of systems for which the nonequilibrium work theorem has been derived rigorously either by Hamiltonian [C. Jarzynski, J. Stat. Mech. (2004) P09005] or stochastic methods [G.E. Crooks, J. Stat. Phys. 90, 1481 (1998)]. Nevertheless the validity of the nonequilibrium work theorem is confirmed both numerically for a wide range of parameter values and analytically in the limit of a very fast moving piston, i.e., in the far nonequilibrium regime.