Cook the onion in butter until it is tender. Stir in the flour and pepper. Add milk all at once. (At first there will be flour globs floating around in the milk and you will think you did something wrong - you didn't). Cook over a medium flame until it is thick and bubbly, stirring regularly. Remove from heat. (You might need to add a little more milk if it too thick).
In a small bowl, combine peas, basil, and parsley.
Place a third of the potatoes in a large greased casserole dish. Then top with a third of the ham, a third of the peas, and a few pieces of onion. Cover with a third of the sauce. Repeat layers.
Bake, covered at 350 for 40 minutes. Uncover; bake for an additional 30 minutes or until the potatoes are tender. Let stand for 5 minutes before serving.