A torrasque appears in StarCraft: Enslavers in the final mission of the A-branch missions, where the player rescues the protoss forces. The torrasque will attack the player's base and respawns some time later when killed. Until the cerebrate is killed, the torrasque will forever reincarnate. This same mechanic is used in Episode V in "To Chain the Beast," where the torrasque is spawned by the brown-colored zerg force until their cerebrate is killed.
In both missions, walling off the player's base with supply depots is the best way to defend against the torrasque. Several siege tanks in siege mode are best to bring it down, as its high armor makes it highly resistant to weaker units.
A torrasque can be founded as a feral zerg in the Episode VI mission Reign of Fire, and can be recruited to the player's control.