What IP address is being used in both cases? This problem can easily occur if you're poisoning your DNS on the server and hence connecting to a different IP address on the server, because SSL vhosts are typically attached to a particular IP address to ensure the correct certificate is returned.