I get a leak also in rain. I find that if I park with the front end of the Jeep at least slightly elevated, the water entry will be much less.
It may be the window, but I am not sure. I have heard that the screws for the roof rack (or the sun roof if you have one) can leak also. If the drains from the roof are plugged, then water can build up and spill onto the headliner. It then can drain off of the headliner onto the floor.
Thus, I am not sure whether a window replacement will fix it or not.
'06 XK Limited, 5.7L Hemi, Quadra-Drive II, Black, 107K Miles
'02 WJ Overland, 4.7L HO, Quadra-Drive, Inferno Red, 92K Miles