I've regularly written and given away complete projects as genuine open-source projects; some of them have even been popular. (Where popular means from hundreds to thousands of users; though in all honesty most of them have less than that).
But recently I came up with a good implementation of a spam-filtering solution; as you say piggy-backing on the work of others. (I did submit several trivial patches; but most of the code is both specific to me, and non-public).
This is the only time I've explicitly been in the situation of writing code with the intention of charging people money for it. It just seemed obvious to me that I should be selling it, partly because it works, and partly because there is a potentially large market.
Now you're not specific about your application, but your general question feels like a "how do I make money" question - and my only suggestion would be that you install it yourself, on machines you control, and then make it available as a "Web Application". i.e. You offer a service and not an application.
By hosting the application yourself you don't need to run the risk of showing anybody the code. Although the downside is that you really do become a single point of failure (which speaking personally is stressful) but it can be a good tradeoff to make, depending on your niche, and the willingness of others to trust an outsourced service.
(ObLink: Managed anti-spam solution - small because I'm giving info, not trying to pimp for customers. THough I wouldn't object ;)