Here is the solution. In case of multiple deletion, use those 2 sql queries. First sql query will link orders to customers, and second query will show the orders in the customers account (orders tab)
UPDATE sales_flat_order as SFO
INNER JOIN customer_entity as C
ON C.email = SFO.customer_email
SET SFO.customer_id = C.entity_id
WHERE SFO.customer_is_guest = 0
UPDATE sales_flat_order_grid as SFOG
INNER JOIN sales_flat_order as SFO
ON SFO.entity_id = SFOG.entity_id
SET SFOG.customer_id = SFO.customer_id