Stir together potatoes, eggs, and 2 tablespoons flour; place in a lightly greased 10-inch tart pan.
Bake at 400° for 30 minutes.
Cut onions in half, and cut halves into slices.
Melt 1/4 cup butter in a large skillet over medium heat; stir in brown sugar. Add onion, and cook, stirring constantly, 20 to 22 minutes or until golden brown. Remove onion, and set aside.
Melt remaining 1/4 cup butter in skillet over low heat; whisk in remaining 5 tablespoons flour until smooth. Cook, whisking constantly, 1 minute.
Add milk gradually; cook over medium heat, whisking constantly, 3 to 5 minutes or until onion mixture is thickened and bubbly. Stir in salt, pepper, and sherry. Pour over potatoes, and top with onion mixture.
Bake tart at 400° for 15 minutes or until thoroughly heated.