If a sofer takes money for a Sefer Torah and does not supply it, are the STA"M he writes after that considered kosher?
My understanding is there are two questions:
The distinction appears with regards to kosher slaughterers. A person who outright rejects Judaism cannot create kosher slaughter, regardless of his technique or how many people watched him -- it just doesn't work on a metaphysical level.
There are others, however, who are able to create kosher slaughter, but we don't trust them without adequate supervision. (If I recall correctly Rabbi Moshe Feinstein ruled such in several cases.)
So the trust issue is a whole other ball of wax. As far as simply: "if we observed him writing with correct technique and intent, is the product kosher?", I'd assume it is.
A sefer Torah written by a true heretic is of no halachic significance and may (should) be burned. Whereas a sefer Torah written by a proper Jew who later became a heretic should be burie; the Torah itself is kosher, but we don't want people using for religious ritual an item now associated with a heretic.
Applying this logic, Rabbi Moshe Feinstein wrote that Jewish music composed by a fellow who has since become a heretic is less than ideal for Torah scholars to associate themselves with. However if the composer was not a heretic, just someone who let his vices get the better of him, this would not apply -- halacha has no negative attitude towards his music.
So as long as the sofer maintains basic belief and keeps shabbos as far as we know, I don't think we can void the kashrus of his writing.
Whether we can trust him anymore for anything unsupervised, and whether it's wise to do business with the fellow, and so on, are separate discussions ...