Yup, you need to take the "top" of the gatehouse, otherwise you'll get clobbered by burning oil. It makes sense to wait a turn, build a siege tower or two or ladders and a ram. With the seige tower, take the walls and run your guys over the top of the gatehouse and it's yours. If your spy wasn't able to open the gate that turn, you can now use your ram. Wait until you've take the gatehouse before sending the ram, otherwise you'll get a bunch of deep friend soldiers. Of course, this only applies to stone or better walls. Wooden ones have no gatehouses or burning oil.