wash and pick over the beans. soak beans overnight in plenty of water, or, for quick soaking, bring them to a boil with water to cover in large ot, remove from heat, and let stand, covered, for 1 hour.
drain beans. put them back into the pot, cover with plenty of water, and add the bay leaf and salt. bring to boil, then reduce the heat and simmer, uncovered, until the beans are tender but still hold their shape, approximately 45 minutes. drain the beans.
meanwhile, preheat the oven to 375 degrees. heat the oil in a large skillet. saute the onion slices over medium heat for about 10 minutes. add the green chili and garlic and saute another 2 minutes.
add the onion/pepper mixture to the beans along with the corn kernels and 1/4 cup of the chopped cilantro. season to taste with salt and pepper. put the beans in a casserole and sprinkle with the grated cheese. heat for 20 minutes, or until cheese is melted and bubbly on top. serve with dollops of sour cream and sprinkle with remaining chopped cilantro.