Stiles was part of a ritual back in our world where he, along with Allison and Scott became replacement sacrifices in order to find and save their parents. Which was incredibly noble and amazing, and more importantly, it was effective.
But the catch of this was that a darkness would surround their hearts, which has manifested itself in nightmares and the like. There's a door in Stiles' mind that he can't close. If we can't get it to close, there's a really big possibility that it'll kill him.
We're out of options, Caroline. If there's anything you can do to help, please, let us know.