I've not done this to my players personally but have seen it done. Was hilarious. I was sitting on a friend's game he was playing in. Their party had spent two sessions planning to go up against the BBEG, all hindering ENTIRELY on whether or not the BBEG was going to ramble. They had a backup for if he didn't, but it was way weaker and most of the party didn't think it was necessary. Why? Because the villain had never gloated before so CLEARLY he would gloat now at the very end. Like every other encounter with the villain he has said "When you could ruin my plans? Absolutely not" and then attacked. So obviously he would now gloat.
Party positioned themselves in certain locations, failing rolls and KNOWING they failed rolls but nothing happened. They snuck up. Hid. Some of them literally standing on trap doors that were set up to be opened to change the field if battle ever took place. Ones they knew about from the brief time they spent working for him before discovering he was the bbeg. They were that confident that they would be fine.
The ROGUE walks up to the BBEG, some big industrialist bad guy who's trying to enslave the faewild through shenanigans. The rogue confidently says "So I guess you let me walk into your big office throne room fuckin thing, terrible decor by the way, just so you could finally gloat in our face that you won?" and the dude just turns and said "No. So I could kill you easier" and cast power word kill. Everyone turns to the wizard to counter spell where he admits he was SO SURE the plan would win that he replaced counter spell with a different spell for damage. Rogue immediately starts laughing. Wizard comes to the brink of tears from letting the rogue die which the rogue, still laughing, soothes him over. Cleric, who never bought the plan, just staring at the map. My buddy the tanky paladin just smiling and laughing like "Yep. Told you."
The majority of the fight was just laughter from the rogue saying "Nah you two were right" to the cleric and paladin. I distinctly remember the line "Maybe your religion isn't so stupid after all"
This and "The Door Was Unlocked" are some of the best moments you can have as a DM.