[Corrected due to Jason's answer.]
Imagine a torus and a flat disk fitting in the middle of its "hole" (a doughnut with a membrane in the middle). Cut the torus at its inner equator, duplicate the disk, move the two copies away from each other slightly, widen the cut appropriately and join the two flat disks with the sliced torus (anyway you like).
You get a surface $M$ homeomorphic to the sphere - thus with integral curvature $\int_S\kappa = 4\pi$ - , but with integral curvature equal to that of the torus $\int_T\kappa = 0$ plus a contribution from the "regions of agglutination" where the two disks and the sliced torus are glued together (the disks by themselves having zero curvature).
Is it simply a consequence of the Gauss-Bonnet theorem that however smoothly or abruptly you glue the two disks and the sliced torus together the integral curvature in the "region of agglutination" has to be $4\pi$?
Or is there a mistake in my description of the surface or in my understanding of the Gauss-Bonnet theorem?