Do I prevent a possible party wipe?

So here's the deal:The party I'm running though the game with atm is flattening most bosses they come up against, I think this is just because they've spec'ed into doing as much damage as possible and most boss encounters so far have been trying to beat them at their own game, and are burned down before they get a hit in.

The problem is that they're got no spellcasters and the boss fights are starting to sprinkle in some wizards of their own, and I'm seriously worried that the next boss fight might just be the end of them. The party has two gunslingers and the next boss is a transmutation wizard with warp metal as their only level 4 spell (I think you see the problem here).

I'm a new DM and I don't know whether to have him cast the spell and hope its not a tpk, switch it out for another 4th level transmutation spell, or just not have him try and cast any 4th level spells. What would you guys do in this situation?

Edit: I should clarify that the BBEG (CR 11) isn't the only enemy in this boss fight, he's backed up by a Lamia Matriarch Sorcerer (CR 10) and the possibility of a stone giant (CR 8) if I feel it's necessary.