It does appear to be the theme wrapper that is messing with the remove button handling (not sure why) - however it doesn't look like you need it anyway.  The delete option set id, option id, and delta are all read from the parents in the submit handler, so you should just be able to do:
```
$form['mapping']['contexts'][$delta]['remove'] = array(
      '#prefix' => '<div class="personalize-remove-context">',
      '#suffix' => '</div>',
      '#type' => 'submit',
      '#value' => t('Remove'),
      '#attributes' => array(
        'id' => 'edit-option-sets-option_set_' . $osid. '-options-' . $option['option_id'] . '-explicit-targeting-mapping-contexts-' . $delta . '-remove',
        'class' => array('personalize-delete-context', 'form-submit',),
        'title' => t('Delete this context.'),
      ),
      '#submit' => array('personalize_targeting_remove_context_submit'),
      '#ajax' => array(
        'callback' => 'personalize_targeting_context_ajax_callback',
        'wrapper' => $main_wrapper_id,
        'effect' => 'fade',
      ),
    );
```