To paint a weathered wood window, after scraping, sanding and washing, we were ready for oil primer.
To stop water from getting down between the wood and the glass, run an even bead of primer slightly up on the glass, completely filling any gap between the glass and wood with paint. This acts like a gasket to protect the paint from peeling up close to the glass again. When it's time for the finish coats, we follow the same line, though much more quickly that time around. One of our painters appropriately dubbed this 'sealing the glass'.