You find the spot where the stock is updated ...

Find this section of code:
PHP Code:
          if ($stock_left <= 0) {
            
// only set status to off when not displaying sold out
            
if (SHOW_PRODUCTS_SOLD_OUT == '0') {
              
$db->Execute("update " TABLE_PRODUCTS " set products_status = 0 where products_id = '" zen_get_prid($this->products[$i]['id']) . "'");
            }
          } 
And you would need to write some custom code to change the products_to_categories table and the products table to manage which category the Product is now in ...