Going to https://sub.main.tld gives me the same ssl website for main.tld. But if I use http://sub.main.tld I get the correct unsecured site. Troubleshooting this problem is driving me crazy.
It seems that ISPCONFIG was not creating my certificates under /var/www/main.tld/SSL directory so I went to the panel and had to select save certificate several times until it actually did. Then it all began to work.