By request from the comments: here is a link to a Language Log post that, among other things, explains the origin of the phrase.
from your mouth to God's ear (or ... to the Gates of Heaven). May God hear what I/you say and act upon it. Or, as defined in The Taste of Yiddish by Lillian Merwin Feinsilver (1970): 'Fun zayn moyl, in Gots oyer. Lit, From his mouth into God's ear. May God hear what he has said (and fulfil it)!' The 'Gates of Heaven' may be an Arab version. ... The first expression my stem from Psalm 130:2: 'Lord, hear my voice: let thine ears be attentive to the voice of my supplications'. The phrase also appears in the orthodox Jewish prayer book.
The explanation above taken from
Nigel Rees, Cassell's Dictionary of Word and Phrase Origins (2002), p. 90
Contrary to popular belief, 'eating one's heart out' does not necessarily have to mean eating to one's content.
It is a gloating expression, commonly uttered in a sneery tone. For example, you've just achieved an award, won something, or perhaps just done something commendable and you say it to someone who isn't at all happy with your newfound success.
eat your heart out
something that you say which means that you or someone you know can do something better than a person who is famous for doing that thing
'I've just made this coin magically disappear in just a flick of a finger. Eat your heart out, David Copperfield!'
When you are “eating your heart out”, it brings out a grotesque imagery of a heart being devoured, implying that your heart is being “eaten up” and crushed by some painful emotion, usually grief, or jealousy.
Looking at its origin, the earliest reference dates all the way back to 850 BC in Ancient Greece, where it has been found in Homer’s classical text: The Iliad.
In the story, Bellerophon, is described to be “eating his heart out” in grief when Artemis slayed his children. Since then, the notion that grief eats at the heart has been expanded to other emotions usually with negative connotations, for example, jealousy.
Regarding the question, my personal take on why the 'out' is used in eat your heart 'out' would be the emphasis on eating one's heart. Compare 'eat your heart' and 'eat your heart out'. The latter phrase definitely provides a more vivid and emotional imagery. According to thefreedictionary.com, out means "to the fullest extent or degree", and this shows the outburst of emotion that one is facing. Although both might mean the same literal thing, eating one's heart out seems to provide more emotional outburst to a higher degree; it is as if someone is literally removing the heart out of the body and devouring it in grief.
Taking a look at this particular type of phrase, there are some phrases that come across my mind too in the exact same format of x one's heart out, like for example, shout your lungs out.
Now I will try attempt to debunk the phrase of x one's heart out. Keep in mind that the meaning of eating one's heart out is to boast. I believe its meaning evolved to eating to one's content when people started to use the phrase during a served dinner. For example,
"There you go. Eat your heart out."
Technically, with the meaning of boasting, those who knew the actual meaning of the phrase would assume a light-hearted boast about the good quality of the cooking - perhaps even suggesting that one should be envious of such a talent of cooking good food. However, those without prior knowledge would assume naturally of course - to eat to one's content. Over the years, x your heart out would naturally evolve to mean do something to your heart's content, thus giving birth to the phrases dancing one's heart out.
Best Answer
It can have a positive or negative connotation based on the context. Let us take a couple of examples. One involves people and the other involves inanimate things (on the side being compared to sow's ears).
Assume that you're the manager of a team of athletes. You're targeting a big championship but your team is mediocre. If you win, you could say, "I made silk purses of a sow's ear." If you lose, you could say, "I did my best to make silk purses of a sow's ear." In both cases, your effort indicated may hold a positive meaning but the team is obviously referred to as sub-par, and so may be considered somewhat insulting to them.
Assume you are making a magnificent chair out of broken pieces of wood. In this case, you have made silk purses of a sow's ear but there is no insult involved, just excellent craftsmanship.
Sources/Further Reading: