Deleting a task from Sales Order once Quote is marked as Won

Deleting a task from Sales Order once Quote is marked as Won

We have created a custom function for deleting tasks once a quote is won or lost. The lost part of the function works fine. However, when the quote is won, it changes to a sales order and the task is then associated with the sales order. We have tried running a Workflow rule calling the function on creation of the sales order but this is not deleting the tasks...

Any ideas anyone?