You do this by duplicating your thought bubble layer (which you make with the bezier shape tool). You put an outline on the top layer and then add an image mask to it and drag the bottom layer onto the image mask. Set the mask to subtract and it will cut out the bubble.
You can scale the top layer up a bit if you want to alter how much of an edge you have surrounding your bubble. You can feather the bottom shape to change how well it composites with the top shape.