Sorrow is a stimulant in itself. Have you ever seen the movie where the guy goes around an pick up chicks at funerals? Its based on the idea that some women get super turned on and needy when sad. Its the same but opposite at weddings. I think that movie was actually called wedding crashers, Vince Van, Owen Wilson. Either way, perhaps its popping up because of pheramone that you are sending out without knowing it.
He would have no clue either, its sentless. It turns us on.
Another theory is perhaps he sees that you are in need and that in itself turns him on without thinking about it. He wants to help and be close, thuse the erection. He is thinking about holding you and feeling your skin, heck that's enough for me at times.