Here is how I handled the situation. Please respond with any criticism, opinions or advice.
Twelve year old - I simply sat him down after school and had a long talk. I explained that I still love him the same and I don't look at him any differently. I told him that he made a big mistake as a result of the changes his body is going through and the hormones in his body. I said that all boys/men get impulses and ideas but that he has to control them. I explained that he could come to me about anything and I wouldn't judge him or think any differently of him or love him less. I asked him if he had ever been touched that way or any one has done anything sexual with him (I made sure in the way I framed it that he would tell me) and he said he hasn't. He said he didn't know why he did it but he felt curious. I told him that he needs to focus on exploring his own body now and that the other stuff would come in time. I said it cannot happen again or this will escalate the situation and I will have to include doctors, CPS and the police and there would be serious consequences. I also explained that I did some weird things at the onset of puberty as well and that I had all kinds of weird feelings at that time. I didn't ask his about his sexual orientation and told him whether he liked boys, girls, both or he didn't know that I totally didn't care and still would love him and treat him the same. He now sleeps alone and showers alone. I also plan on making more one on one time for him and insuring that at least 30 min a day are spent on father and son quality time. I told him that the mistake is dropped and forgotten about and that he is okay and I don't think any different or love him any less. I then hugged him and told him how much I loved him and that I was lucky to be his father and that he was the best son that a father could ask for.
The three parents involved continue to let him play with the other kids but no more closed doors and the twelve year old sleeps and showers alone now. We will watch for any other signs of sexual compulsion, obsession or deviance and will address that if it is there. I personally think this was a one time thing and was brought on by hormones, curiousity and opportunity. I do understand that this is a serious issue but I think this is all that is needed with the twelve year old unless more behaviour presents itself.
Five year old - I sat him down as well and let him know that the twelve year old touching him was bad. I told him that if any one touches his privates that he needs to tell his mother or me immediately. No matter what the person who touches him threatens or anything. I then repeated a bunch of scenerios where people touch him there and threaten to hurt him or his family if he tells us and he still says he will tell us. I let him know that the twelve year old didn't know it was wrong but he does now. I also made sure that he knows if it happens again that he will tell us. I will continue to present this to him until his answer is automatic and I am certian he will tell us. I told him that doctors may have to touch him there and that is okay because mommy and daddy will be there. He treats the twelve year old the same and seems to have no ill effects from the incident. We will watch for any manifested behaviour or suffering that he might have from it and get help if needed.
Thank you everyone for your help and advice and I think that a lot of the responses were well thought out and understanding. Everyone who replied let me see the situation through their POV and helped me with the ultimate resolution for the problem. I think I took the most reasoned and best response for the children involved and did my best to minimize the damage that not only the act but being caught in the act did to them. Please feel free to comment if you think I dealt with it right or wrong and with your thoughts. I will not talk about the issue with either child unless serousily needed.