That small O ring keeps the oil inside the filter housing so when the engine is off oil is prevented from draining into the sump. Quite important to keep it full for starting the car so the filter housing is full. The centre stem on the filter cap snaps in the top, its just a pressed in fit and the filter slips over it. Not unknown for it to come out when the filter is pulled off and gets thrown away with the old filter by people who do not know what they are doing. You should find a replacement on ebay. Worth noting that not all brands of filters come with that small O ring just the big cap O ring. Bosch and Mann brands seem to include the small gasket.