PF30 cup came out of frame, can it be pressed back in or should it be replaced? I have a carbon bike frame with a PF30 bottom bracket. The bottom bracket suffers from creaking when applying high pedaling forces (high for me that is).

I removed the crank to check the state of the bearings, and to see if the crank axle has been under-rotating in the inner bearing races. As usual the crank needed to be tapped out of the bearings with a soft-faced hammer. Unfortunately, the axle stuck in the drive side bearing and the plastic PF30 bearing cup and bearing came out of the frame.

Obviously the force was applied to the inner race, but I was not tapping the axle very hard, so I don't think the bearing was damaged.

Can I press the cup back into the frame, perhaps using some retaining compound, or should I replace the cups (which will mean replacing the bearings I believe)? My concern is that the plastic cup has been deformed by being extracted and is now undersized.
Once you get the bearing and cup off the spindle, you can assess the state of the bearings a little. Turn them with your fingers while pushing hard in both the radial and lateral directions. This kind of test isn't perfect because the loads applied in use are so much higher, but sometimes it can reveal notchiness or roughness that lets you know you'd be better off replacing them.

Unfortunately, between the creak and the ejection of the cup, it's likely that the bore on the frame is either oversize, roundness-challenged, or both. You could check it with calipers if you want. Any such issues can have an adverse effect on bearing life, as the creak indicates the cup is moving a little which in turn means the bearing alignment won't be ideal. If there's no or minimal wear or roughness detectable, on a personal bike I think it's fine to just re-use it and see what life one can get out of it. While it's convenient I would lift the bearing seal and degrease and re-lubricate it, but that's optional. One nice thing about doing that is once you get it clean and re-check how it feels, you can get a better read on whether any roughness or notchiness was caused by contamination versus damage to the races.

On the other hand, it wouldn't take much perceptible wear for me to just replace it while it's out.

Retaining compound is a good idea and hopefully it will eliminate the creak.