I thought this through before looking at other people's opinions on Wiki, but I'm glad to see I'm not alone... As I understand and use the terms, the difference between guilt and shame is the nature of the transgressions that evoke them.
Guilt comes from the awareness of having done some practical harm, whether through action or failure to act. (Leave aside whether the awareness is factually correct, we all know that people can be made to feel guilty when they have done nothing wrong, but only if they are convinced that they have.) Shame comes from the awareness of having broken some important rule, whether internalised from outside or personal. They often overlap but don't necessarily.
Example of the former: a cop shoots someone who was coming at him with a knife. He feels no shame, because what he did was correct according to both the law and his beliefs, but he feels guilt at having killed.
Example of the latter: you find a high value banknote blowing down the street and stick it in your wallet. You feel no guilt, because there is no realistic way you could return it to whoever lost it, but you might feel shame if your belief system tells you that you should work for what you have.
Both of these are conditional reactions, not absolute ones. Nobody but a Jain can live without causing harm to anything, so everyone has thresholds for what level of harm to what creatures or people they can cause without feeling guilt A large part of socialisation is programming these levels appropriately. A sociopath is essentially someone whose guilt thresholds are off the top of the scale.
Similarly, anyone who can live without ever breaking or bending their principles either has very easy rules or rewrites them retroactively: so anyone but a fanatic has fuzzy zones where they don't actually feel ashamed of breaking their rules, but are uncomfortably aware that they are pushing it.
There's more, but that's all I have time for now, I'll get back to this.