My first profitable app was a ruby/rack based CMS I built for my affiliate sites.
I had to make something ridiculously secure, simple to develop, easy to maintain and extremely fast - all while keeping uptime as near to 100% as possible. It ended up evolving into the product I use today across all my systems and gets better with each revision.
I consider it profitable as even though no one besides myself uses it, it has more than repaid the time I spent developing it and the sites it runs provide a large chunk of my company's revenue.