He had me in stitches

Does anyone know the origin of this phrase?

My guess: It means he made me laugh until my sides hurt. "Stitch" originally meant a sharp thrust or stab. As early as the year 1000 it was used for an acute spasmodic pain in the side, as if stabbed (Oxford English Dictionary).