try this.
this checks for a detailed image and if it finds one shows the first . if it dont it shows the thumbnail instead.
Code:
{if $images}
{**** START - SHOW FIRST DETAILED ***}
{section name=detailed loop=$images}
{if $images[0].tmbn_url}
[img]{$images[detailed].tmbn_url}[/img]
{else}
[img]{$xcart_web_dir}/product_image.php?imageid={$images[0].imageid}[/img]
{/if}
{/section}
{**** END - SHOW DETAILED ***}
{else}
{**** START - SHOW THUMB ***}
{include file="product_thumbnail.tpl" productid=$product.productid image_x=$config.Appearance.thumbnail_width product=$product.product tmbn_url=$product.tmbn_url id="product_thumbnail"}
{**** END - SHOW THUMB ***}
{/if}