The Big Red Button
Deep in the dungeon, the players find a room filled with magical darkness. As soon as they’re deep enough in the room, the doors slam shut (how you achieve this is up to you, I used a pressure plate). Then the darkness dispels, revealing menacing spikes glinting on the ceiling. The room is obviously a death trap, with narrow vents to let in poison gas, and probably a method for the ceiling to lower and crush the PCs. Here, go all out describing the many ways in which the room will likely kill them.
In the middle of the room is a single red button, and above it countdown of some sort, counting down from 20, with the word “Life” inscribed above it. The players will likely scramble to press the button, and this will reset the timer. For maximum effect, have an actual timer out, and make them press the button to reset it. When they examine the doors they came in through, they’ll find that forcing them open is far beyond their capabilities. Here I threw a clue at them, a hidden inscription that said “the only escape is death”. Feel free to include a bunch of red herrings to keep them trying to escape.
At the end, the solution is simple, when the timer runs out, the doors to the room open, and the PCs are free to go!