It may all be loaded into RAM if it is small enough and there is enough RAM. But even so, every change (commit) must be saved to a non-volatile medium such as a hard disc, so that the system can recover it following an outage.
But you are right that deleting direct from the database can cause a crash. When say a user account is deleted directly, any post by that user will still link back to the account. and if someone views the post & clicks through, the software will probably assume that the account is still there to be linked to. If it isn't, expect the unexpected, such as a crash. Safer to delete posts & other fingerprints first, then the account. GUI tool designers tend to think of these sorts of things, so mandraulic GUIs tend to be more robust than direct database queries (e.g. allowing admins to lock the account but leaving out a "delete" button). And usually mandraulics is the only way to drive the GUI.
"Klinger, do you know how many zoots were killed to make that one suit?" — BJ Hunnicutt, 4077 M*A*S*H