As a fellow GM, what I usually do when I want to do something like this (which isn't often!) is present the group with an impossible choice in three steps. Let me explain.
A small disclaimer
In my opinion, players and groups are roughly divided into two broad groups: (1) plot-oriented players; and (2) system-oriented players. The solution below is targeted towards plot-oriented players, for whom it should (read: will) be very satisfying. This will not work as well for system-oriented players, who will probably enjoy a very challenging boss fight more, at the end of which they manage to free the old characters just before succumbing to their terrible foe. So plot lovers, this is for you.
Step 1: The Setup
Something the group has done in the past (something that can have been inserted into the campaign for just this purpose, but should never be obvious) comes back to bite them in the ass. It's their fault, and they know it. At the point in which you reveal this, make sure to make them feel guilty about it.
A few days after rescuing that important-NPC-who-has-an-important-piece-of-information-
they-need-to-enter-the-city from a group of maddened monks (who would do anything to keep the group from releasing the prisoner), the group thinks they have found the great demon's hiding place: a hut deep in the local marsh.
They storm the hut's proverbial gates, only to come across the rescued prisoner again, now appearing in his true form: the great demon's boss, who had just sacrificed a dozen innocents to summon his army in order to wipe out the last shreds of resistance from the city and further his conquest to further lands.
Shocked, they realize they have played right into the (smaller) great demon's plan, and have in fact unleashed a terrible horror upon the realm. They have possibly doomed the entire world. They have additionally personally massacred everyone in a monastery of a good and nice god of light, who has kept the demon in chains. The monks were maddened by his dark and terrible influence.
Step 2: The Buildup
Good so far? Onwards!
Now, the next step is to guilt-trip the group. You want them to suffer for their actions. You want them to feel very guilty, but also very angry at the BBEG and\or accomplices. This step is crucial for the third and final step to work.
The BBEG hurts people they love, or on whom they are sworn to protect. He intends to destroy their empire next. Perhaps he makes it personal and kills off important NPCs in the group's (or, if appropriate, in individual characters') past. All of this is their fault, and you should have them feel terrible about it.
(I know that this sounds a bit brutal, but my experience shows that players more often than not greatly appreciate the emotional stimulation, if done in good taste.)
Having escaped from the hut (more or less in one piece), the group decides to leave the city to visit an old and sacred church a few days' travel from the city, where they have stopped to rest on the way to the city a week earlier. They are close friends (possibly students, children, admirers, etc.) of the kind and elderly bishop who runs the church.
One of them fell in love with a local priestess. Another spent the previous stop there browsing through their huge library and vowed to come back some day. Another spent his previous days there eating to his heart's content of the many delicacies they have served him. Also, they were on the verge of finding a cure for cancer. In short, they are extremely emotionally invested (and battered, from the previous step) in this church, and are anxious to return there.
Upon their arrival, they discover the halls barren and empty, and are instantly aware of a pungent, sickly smell they can't quite place. After exploring for a short while, they arrive in the main hall of the church to find the many residents of the church in cages. Some have been lashed to death, and some have died of thirst or of grief. They all look sickly and wan. They find the bishop, who makes them swear to kill off the demon, no matter what it takes, before finally dying.
Then the lesser great demon shows up and sends goons to stall the group while he burns the church down. They manage to escape just in the nick of time. They feel somewhat depressed but more set than ever to kill of the demon.
Step 3: The Sacrifice
Having done all of this, now you have to bring the group to sacrifice themselves for their higher purpose: namely, killing the BBEG. Secondary goals (such as releasing the old group from captivity or rescuing them from certain death) should be done either before the battle, or just after it or in the end of it, with their dying collective breath. This makes it very rewarding for the players, who have given up their lives to save the world and get revenge, and nicely ties everything off.
Returning to the city, they discover the actual location of the great demon's hideout, and make their plans to attack it. Once they're inside, the find the great demon and start fighting. He's incredibly powerful, and they quickly realize they can't hope to defeat him straight on. However, next to them is a room full of barrels filled with black powder that has been amassed for ritual or warfare use.
So they try to hold him off while the resident rogue works on opening the door. In the meanwhile, one of group mysteriously disappears. Finally, after having suffered a few losses, they manage to barge into the room with the barrels only to find it to be a dead end. They can't get out of there, and now the demon blocks the door. Cue flashback to the old bishop saying the god of light watches over their souls, they (from lack of choice, but still heroically) blow everything, including themselves, up, dead great demon.
Meanwhile, the one who mysteriously disappeared has fallen down a long chute, to a hidden cellar, where he finds a group of scraggly prisoners. He's heavily wounded from the fall, and just manages to spring the lock on their cell before a piece of the stone ceiling collapses on him and he dies.
The GM whips out the old character sheets and tells everyone how after a month of seeing no one but the imp slave who gave them food and drink, a heavily wounded man with a haunted look in his eyes walks up to their cell and breaks the lock before a loud explosion rocks the room and he dies from a large stone falling on him and smashing his head. Cue end session. Exeunt.
This should do it. I hope this answer will help you, even if it did come out a bit long. Best of luck to you!
P. S. For bonus points, I'd throw in:
A prophecy at the beginning about them releasing the harbingers of peace, who are destined to [insert next plot hook here], and-
A theme of madness, that increases the more they progress through the plot. Ties in nicely with the mad monks. Also, have the last character die from a falling chunk of ceiling and other wounds, but when you describe it to the old characters, say he seemed manic and was mumbling nonsense, before collapsing to the floor and foaming. By the time they get to him, he's dead.
Best of luck!