Cut the ham into cubes. Mix the sour cream, egg, milk and spices in a bowl with a whisk. Add the ham and 2/3 of the cheese and stir again briefly.
Roll out the frozen puff pastry and cut into suitable squares. Brush the upper edge with water and spread a large tablespoon of the mixture on the upper side, cover, place on the tray and brush with water, then sprinkle the rest of the cheese on top.