I realize your question is more exestential, so I don't know if you'd call it "pain", but your brain does absolutley experience somethings even if "you" don't.
Children under three who receive anesthesia under three can have fewer cross hemispherical connections. Also, empirically not philosophically, however you want to define "you", it's deffenitley something emergent from different physical parts. The brain isn't a singular computer, it's a lot more like compartmentalized systems that work closely. Blindside, for instance, is a wild phenomena where part of your optic nerve going to (I forget where, the back I think) is severed. And that's the part that links that sensory input into all the concepts and interpretion. Hold a card up to this person, they'd have no idea what's on it, or even know you're holding anything up. They're blind. Lights out, can't see, blind. BUT in blindsight the nerve to the brain stem is still intact.
So toss a ball to them and they might catch it.
Point being, parts of your brain may still experience "pain", and react ("remember"). I'd imagine which parts have a lot to do with the specific anesthesia.
Even without drugs, infants who were incredibly traumatic situations (the kind of thing I'd rather not specifically name) will have no memory of the events, but have a larger amygdilla. They'll have a hair trigger fight or flight response and have no idea why unless told. The part of them that forms memories may as well not have experienced it, but part of them did.