This issue can be resolved with a module.
Create a new module with the following files:
/app/code/local/MyCompany/Deactivateproducts/Model/Observer.php
<?php
class MyCompany_Deactivateproducts_Model_Observer
{
public function salesOrderSaveAfter($observer)
{
$storeId = 0; //the admin store view, change this if you want to disable only for the store view from which the order came
$order= $observer->getEvent()->getOrder();
foreach ($order->getItemsCollection() as $item) {
$stockQty = (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($item->getProductId())->getQty();
if ($stockQty == 0) {
Mage::getModel('catalog/product_status')->updateProductStatus($item->getProductId(), $storeId, Mage_Catalog_Model_Product_Status::STATUS_DISABLED);
}
}
}
}
/app/code/local/MyCompany/Deactivateproducts/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<MyCompany_Deactivateproducts>
<version>0.1.0</version>
</MyCompany_Deactivateproducts>
</modules>
<frontend>
<events>
<sales_order_save_after>
<observers>
<deactivateproducts>
<type>singleton</type>
<class>MyCompany_Deactivateproducts_Model_Observer</class>
<method>salesOrderSaveAfter</method>
</deactivateproducts>
</observers>
</sales_order_save_after>
</events>
<routers>
<MyCompany_Deactivateproducts>
<use>standard</use>
<args>
<module>MyModule_Deactivateproducts</module>
<frontName>Deactivateproducts</frontName>
</args>
</MyCompany_Deactivateproducts>
</routers>
</frontend>
</config>
Also don't forget to create the /app/etc/modules/MyCompany_Deactivateproducts.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<MyCompany_Deactivateproducts>
<active>true</active>
<codePool>local</codePool>
</MyCompany_Deactivateproducts>
</modules>
</config>
And replace "MyCompany" string from the above code with the name of your Package/Company