"Jack Slater IV" villan Benedict, delighted that the real world has no heroes to oppose someone like him, decides he will use Danny's magic ticket stub to summon all the great movie villains to take over the world. The first one he summons is the Ripper, the villain from the previous Jack Slater movie, offering him the chance to destroy Jack by killing his actor -- Arnold Schwartzenegger, of course -- at the "Jack Slater IV" premiere.
Jack and Danny get wind of Benedict's plan and attend the premiere; while they save Arnold, the Ripper kidnaps Danny and hauls him to the theater roof, intending to throw him off before Jack's eyes -- the same way he killed Jack's son in the climax of "III". This fails, and Jack kills the Ripper once more. Benedict then shoots Jack in the chest, and though Jack is able to kill him when Danny distracts him, he is now dying. His only hope is to return to "Jack Slater IV" (where the injury would only be a flesh wound), so they go back to Nick's theater, but since the stub was blown away via the battle, the portal doesn't open.
They get a helping hand from Death himself. The lost stub landed in front of a theater screening "The Seventh Seal", and he was drawn from the film and followed them here because Jack's dying (though, since he is not real, Death doesn't recognize him). He suggests that they find the other half of the ticket -- which is in the box of stubs in the lobby, right where Nick put it after tearing it in two in the first place. Danny retrieves it, and the portal reopens.
Jack immediately recovers in the film and Danny wants to stay with him, but Jack convinces him to go back to the real world and take care of his mom, promising the boy that he'll be okay now that he has a better idea of who he is and how his world works. He starts by finally telling off his blustery boss Dekker, and then drives off into the sunset.