Melt butter in a 2-qt. saucepan over medium-high. Cook onion until golden, 8–10 minutes. Stir in flour; cook 2 minutes. Add coffee and cream and transfer to a blender; purée until smooth. Return gravy to pan; simmer over medium until slightly thickened, 2–3 minutes. Roughly chop 2 oz. of the ham; stir into gravy with the vinegar, salt, and pepper.
Heat oven to 400°. On a lightly floured surface, and working with one sheet crescent dough at a time, roll dough into a 9" x 12 1⁄2" rectangle. Cut dough lengthwise into six 1 1⁄2"-wide strips. Twist strips, one at a time, by holding ends of strips and twisting dough in opposite directions. Coil one twist of dough around itself to make a 2" round. Pinch the end of a second twist of dough onto the round; continue coiling dough to make a 4" round. Tuck and pinch end of dough under danish to seal. Transfer danish to parchment paper—lined baking sheets; cover with damp dish towels until all danish are formed. Using your fingers, press and stretch the center of each danish to make a shallow well. Brush danish with egg. Cut out twelve 4" squares of parchment paper; place one square over each danish. Fill wells with dried beans or pie weights; bake until golden and puffed, 10–12 minutes. Remove paper and beans. Spoon gravy into wells of danish, top with remaining ham, and half the pecorino; bake until browned, 6–8 minutes more. Garnish with remaining pecorino.