Don't you just hate it when that happens? Sadly, as far as I know, all you can do is either try to guess where the foreground ends and edit it by hand or, if the background shares few colors with the foreground, use an advanced painting program to replace the colors of the background by a neutral tone which is easier to remove afterward. If both layers share most of the same colors, then you are truly and hugely fucked. Good luck; this kind of problem has made me quit mapping several games so far.
---
"With the first link, the chain is forged. The first speech censored, the first thought forbidden, the first freedom denied, chains us all irrevocably." [...] The first time any man's freedom is trodden on, we're all damaged. - Captain Jean-Luc Picard
B*tch, meet reality. Reality, meet b*tch. - Me