Well,
I believe all you need to do is specific value for your buttons:
<form action="newthread.php?tid=XX">
...
<button type="button" value="submit" name="submit">Post Thread</button>
<button type="button" value="previewpost" name="previewpost">Preview Post</button>
...
</form>
Then you can start using your existing javascript code to handle the AJAX.