The entry object is available in both hooks, so how about saving the created post ID as meta on the entry with gform_update_meta()
:
gform_update_meta( $entry->id, 'order_id', $post_id );
Then retrieving it in the confirmation, using gform_get_meta()
:
$post_id = gform_get_meta( $entry->id, 'order_id' );