Let´s use some imagery, in the event of Jane Doe being married to John Doe, and then they split.
Now think that John remarries to a Sally Soccer Mom.
Chances are (in our example, it will happen) that Jane regrets her decision or she gets jealous (com inveja), so she eats her heart out.
Let´s say, she sees John being nice to Sally, or all of sudden Sally and John are more prosperous now, things like that, whatever. Chances are that Jane is going to feel deep sorrow about not staying with John. So, she is eating her heart out (tem dor de cotovelo, por tê-lo perdido)
And vice-versa. It could be the other way around, of course. John could be the one that had that feeling of loss.
Another sense would be close to it, as an example:The Brazilians are eating their hearts out over their defeat by Germany in the World Cup.
Os brasileiros estão "amargando" a inveja/a dor de ter perdido para a Alemanha na Copa do Mundo.
Could also be "os brasileiros estão morrendo de inveja/os brasileiros estão fazendo só o que podem agora, ter inveja, nada mais..."
[notice: translations a bit following the sense, not a literal one.]https://en.wiktionary.org/wiki/eat_one%27s_heart_out