My suggestion. Get out of php, put in your div and script, turn php back on.
if($spTopicView->currentPost==1) { ?>
<div id='div-gpt-ad-1385134515547-2' style='width:728px; height:90px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1385134515547-2'); });
</script>
</div
<?php }