Does anyone know if this is possible? Has anyone ever done this?
If so, is it as simple as new spring, barrel and magazine? If it's not that simple, I wouldn't do it. What about cost for these parts?
The diameter of the case head of the 40 is bigger so it won't be an inexpensive project.
The only way to make this work is to get a full .40 caliber top half (barrel and slide assembly) of the same length, and a .40 ejector housing for the frame. Assuming your 9mm is a later-production 3-pin frame, a new .40 top end and ejector housing would turn it into a .40.
As said above, the breechface on a 9mm slide is too narrow to allow a .40 case to slide up and sit against the breechface at all, so a new slide and barrel is required to make this work.