Why not get it all over with, and have the NPC just surrender?
No single 8th level spell + 2 7th level spells is going to put even a moderate dent into the stride of 7 17th level PCs... and then 2 NPCs "of similar level".
Given this, the smart move would be to surrender, give up, acquiesce to their demands.
Then the former BBEG can plot his revenge, while pretending to reform.
Maze can take out 1 PC for the duration of the fight. Otto's Irresistible Dance can take out one for 2-5 rounds. Trap the Soul can do similar. Power Word Stun can also take out many PCs of that level for the duration of the fight, though not hit point tanks. Avasculate is great at weakening a hit point tank - I used it once against the raging barbarian... Me: "How many hit points do you have?" Player: "274?" Me: "You take 137 points of damage and need to make a Fortitude save now..."
Firestorm can be a good clerical one to take down hit points for several PCs at once, as it is shapeable and has a huge area of effect (17 ten foot cubes at level 17) Probably won't kill them, but can heavily weaken several.