The problem in this scenario is that you're processing this traffic twice:
First, the browser sends a CONNECT to port 8888 saying: "Please give me a TCP/IP tunnel to port 7777" and then after Fiddler says "Okay, we'll do that" the client sends a HTTPS request through that tunnel to port 7777.
The problem here is that you're mangling that CONNECT response and returning HTML instead of allowing the HTTPS handshake from port 7777 to flow through.
The simplest way to fix this would be to change your BeforeRequest code to the following:
if ( (oS.hostname == sSecureEndpointHostname) && (oS.port==7777)
&& !oS.HTTPMethodIs("CONNECT")) {
After you do this, your CONNECT tunnel will no longer be getting mangled and the HTTPS handshake will succeed.