For those wondering, we didn't die mostly due to a well-placed Disintegrate. My "stick an immovable rod in its innards" was disappointingly low damage.
For those wondering otherwise, our best plan involved turning it into a regular worm, using an immovable rod with a hole drilled through the length of the staff, clicking the rod, then dispelling polymorph.
Diabolical. I'm thrilled by the idea of it happening to someone else.