Cut off ends of spaghetti squash, then carefully cut into rings. (To make this very difficult task way easier, I microwave the spaghetti squash for 4 minutes before cutting. This does make the finished squash sliiiiightly more soggy, but it really helps with the cutting.)
Place rings on a large baking sheet, drizzle with olive oil, season with salt + pepper, and bake at 400 for about 25-30 minutes, until cooked through. Shred into "noodles" with fork and discard skins.
While spaghetti squash is baking, melt butter in large cast iron skillet over medium heat, then add onions, cooking until they start to brown. Season with salt and splash with a little broth to deglaze the pan and keep the onions from burning. Cook until they're a deep brown, adding splashes of broth as needed to keep the onions moist and not burning. This will take several minutes.
Mix together squash, caramelized onions and sour cream, then put half in a medium-sized buttered casserole dish. Top with 1/2 cup each of cheddar + gruyere. Spread the rest of the squash on top and sprinkle with remaining cheddar and gruyere.
Bake at 375 degrees for 25 minutes, then broil for a minute or two if needed to create a bubbly, golden brown cheese crust on top.