I am a little crunched for time so I am going to try and guide you through without testing what I am telling you, if it doesn't work, don't despair, just let me know. All of this is pseudo code.
First look at: /common_files/customer/main/order_message.tpl
Look for: {foreach from=$orders item=order}
Right under this is the included invoice template {include file="mail/html/order_invoice.tpl"...
We want to switch between templates so setup an if statement:
PHP Code:
{if $some_var eq 1}
{include file="mail/html/special_invoice.tpl"...
{else}
{include file="mail/html/order_invoice.tpl"...
{/if}
Above that we need to test for the product, right after the foreach statement that loops through the orders, start another one and check for the product id. if it is found assign the $some_var we referenced in our if statement:
PHP Code:
{assign var="some_var" value=0}
{foreach from=$order.products item=product}
{if $product.productid eq 23}
{assign var="some_var" value=1}
{/if}
{/foreach}
Make sense?