Can I somehow protect any application against piracy? Is it even theoretically possible?
No, and it's a complete waste of time and effort to even try. When Microsoft's new OSes have cracked versions available before release day, and they put more R&D money into just that one feature than you'll ever see in your whole life, that should give you a bit of perspective.
Making the source available just makes it easier to copy, but either way, there's no way to keep a program you distribute a copy of to another person from being copied and distributed even further. The basic problem is that the computer needs to read it in order to execute it, and if the computer can, so can someone who knows how computers work.
It's been called "the fundamental question of cryptography:" Alice wants to send a letter to Bob, without Charlie being able to read it even if he should get his hands on it. The problem in this scenario is that Bob and Charlie are the same person.
So don't even worry about trying; it's a waste of time and money. As Ordous said, your protection should be legal in nature, not technical. And to add to that, the best protection against piracy is using human nature and basic capitalism to your advantage. Generally speaking, people want to be good, and see themselves as good. So if you follow fundamental market theory, and offer a good product at a price that is less than what they perceive its value to them to be, they will be willing to pay for it even if an illegal alternative exists. Piracy is almost always a symptom of excessive pricing or poor attention to the needs of the customers.