op goes back a ways.
Is castling better to protect your king or not to castle?

I would say it depends on the position. sometimes it is suicide to castle (as the OP's example proves) sometimes it could save the game. other times it might just be to get the rook active.

In the first position, I would say that the black Queen takes White's Knight and just wins. Your castled King is safe.
As with anything in chess (and life), it depends on the situation. Castling is often good, but there are certainly exceptions. I find that if I play the French Defense and my opponent goes for the Advance variation (1. e4 e6 2. d4 d5 3. e5), the pawns are locked in the center, white's going to attack on the king side, and black's going to attack on the queen side. So I've found that black actually tends to be safer not castling in that case, while white almost always castles on the king side.
--Fromper