I feel for your confusion at the circular definitions. Here is how I think of these as a native English speaker.
First, you know that all of these terms refer to many things all located close to each other so they are thought of as related as a group. Usually, if they are physical things, they will be very close, maybe even touching each other, often on top of each other. If they are abstract things, then they are related in another sense of close together or collected.
Usually, these terms are not used for live or animate things, unless to make a point by being odd. However, they can be used for dead things, e.g., a pile of corpses.
Now, there are two properties that you have to ask about to tell the terms apart.
- How big is the group?
- How organized is the group?
A heap is big. A stack and pile can be small, medium, or big.
A stack is organized. A pile and heap can be organized or unorganized, but often unorganized. Other concepts similar to organization here are alignment and order.
These are only the main meanings that come to mind. It would not be incorrect to say that an organized group of papers is a pile of papers. It would also not be wrong to tell someone to organize a stack of papers, because maybe it is not organized to this person's standards.
So if a group of papers is small, you should not call it a heap. And if a group of papers is very messy, you should not call it a stack. The others are more flexible and vague.
When you are talking about abstract objects, you should be more careful about using stack and pile. It is common to say he is in a heap of trouble, I have a heap of problems, or I'm gonna/going to give him a heaping of hurt. The word mound also covers some of the same ground. It is less common to describe a group of abstract things as a pile or stack. Two notable exceptions are of course when these are technical terms for mathematical objects or datatypes. I suspect this might be because the real meaning that heap adds in the former case is bigness. I have a heap of problems means that you have a lot of problems all close together.
If this is a lot to remember at once, you can think roughly of these terms as growing increasingly specific. RoaringFish's comment made me think of this ordering, which is by increasing messiness:
stack ≤ pile ≤ heap
You might also think of these as being proper inclusions if you are familiar with sets:
stack ⊂ pile ⊂ heap
This picture depicts these relationships.
This means that everything that counts as a stack can also be called a pile or a heap, though calling it one of these is being less specific (you should generally be as specific as appropriate). Everything that can be called a pile can also be called a heap. But you cannot go in the other direction. There are things that you can call heaps but cannot call stacks.