How to use AJAX form on custom maintenance page
When you put your site to offline mode, the menu router system (which is called first when a request is received to serve a page). 

By default, Ajax forms are handled from the path system/ajax, which is not allowed when the site is in offline mode. This is not an issue with Drupal itself, it's just that when a site is in offline mode, there is no guarantee that any system is in working condition. 

Ajax forms require the form to be cached, and that cache storage is the database unless you alter otherwise. When the database connection is failed, Drupal returns the same maintenance-mode page. Now, if you embed an Ajax form, imagine how there will be a recursion. 

If you still need an Ajax form, you need to implement hook_menu_site_status_alter() to alter the site status for a specific path. Then, in your form, your will need to turn off caching ($form_state['no_cache'] = FALSE), and add your own #ajax properties with especially ['#ajax']['path'] set to your custom path that bypasses site status check (from the hook_menu_site_status_alter() hook). 

I didn't bother to write an example since your question indicates you already have the Ajax form setup. Disable its cache, add a custom path to handle the submitted data, and make that path accessible with a hook_menu_site_status_alter() hook.