You can do it with a custom module.
add this in the layout xml of the module
<checkout_onepage_success>
<reference name="checkout.success">
<block type="[module]/[block]" name="some_name" as="some_name" template="[module]/success.phtml" />
</reference>
</checkout_onepage_success>
Now you need to create the block with alias '[module]/[block]'. and the template [module]/success.phtml
and add your logic in them.
You can even skip the creation of the block class and replace [module]/[block]
with core/template
and add your logic in [module]/success.phtml
but it's cleaner with a block class.
Note: Don't use '[' and ']' in the block names and aliases. I put them there just to mark that those are placeholders.