Sorry for the delay in the response. I wanted to make sure I had time to write the length response that this was going to require.
Deleting a ticket and/or user at the sql level is a lot more involved than just deleting all tickets with a specific user id.
The problem is that there are a number of other tables that have entries based on the existence of that ticket or user.
the ost_form_entry_values might have data. the ost_thread, ost_thread_collaborator, ost_thread_entry, ost_thread_entry_email, ost_thread_event, and ost_thread_referral tables might also have entries. ost_user, ost_user__cdata, ost_user_account, and ost_user_email. All of those things would have to be purged also.
You can get the user id from ost_user. Then you can use that to delete information from:
ost_user__cdata (you could always just drop this table, it will be recreated)
ost_user_account
ost_user_email
With the ticket_id you then delete entries from the following:
ost_ticket
ost_thread,
ost_thread_collaborator,
ost_thread_entry,
ost_thread_entry_email,
ost_thread_event,
ost_thread_referral
To delete a ticket something like this:
SET @ticket_id = 0;
SET @thread_id = (SELECT `id` FROM `ost_thread` WHERE `object_id` = @ticket_id AND `object_type` = 'T');
SET @thread_entry_id = (SELECT `id` FROM `ost_thread_entry` WHERE `thread_id` = @thread_id);
DELETE FROM `ost_ticket` WHERE `ticket_id` = @ticket_id;
DELETE FROM `ost_ticket__cdata` WHERE `ticket_id` = @ticket_id;
DELETE FROM `ost_thread` WHERE `object_id` = @ticket_id AND `object_type` = 'T';
DELETE FROM `ost_thread_collaborator` WHERE `thread_id` = @thread_id;
DELETE FROM `ost_thread_entry` WHERE `thread_id` = @thread_id;
DELETE FROM `ost_thread_entry_email` WHERE `thread_entry_id` IN(@thread_entry_id);
just replace @ticket_id with the actual ticket_id from ost_ticket
So with that you should have a pretty good starting point I think.