When something goes wrong. Can be used to express anger or disappointment.
Honestly, it's a bit crude, but this translates to 'shag a dog'. It's much the same a 'F**k a Duck', but a dog is more like a human than a duck is, so that's surely less offensive, and shag is a mild version of f*ck.
Therefore is a better fit for family dinner table usage...
Can be extended indefinitely with Popeye-esque "ug" post-fix : "Shuggadug-ug-ug-ug!"
Shugadug! Someone put the empty Margerine tub back in the fridge!