This would be an alternate to your existing IPN page, so it would not have to do any of the tricky IPN stuff that your current IPN page is doing.
You can start out with a new blank page that just has some of the same server behaviors as the IPN page does. Based on what you have posted here you should have a store order summary to update the table in the db to indicate the order was successful. Next you would want to add in your Universal Email server behavior to this page. For the redirect you can send the user to your checkout success page.