Have you thought about using radio buttons instead of check boxes? Radio buttons have the behavior you want - only 1 can be selected, and they automatically toggle. Its commonly understood by users, its standard, and its 1 line of code for each button.
Initially, that was my code, but I ran into an issue where I had 3-4 sets of radio buttons, all with different ids, but when a button from Section 2 was clicked, the one from section 1 would unclick, leaving the user to wonder if their changes were saved...which they were
Radio buttons are grouped by the name attribute and not by the id attribute. If the buttons in Section 2 have a different name than those in Section 1 (name=group1 id="male", name=group2 id="male"), you should not see the behavior you describe above.