I don't see this story as related to God, per se. He didn't do the crimes against this woman, humans did. But most people apparently knew that was wrong, otherwise the resulting conflict wouldn't have happened, nor would it even have been written down as if it was important.
It is no more or less evil than many of the other events recorded in various parts of the Bible. Murder, incest, more murder, more incest, genocide, rape, and so on. If we ask how it explains God's wisdom, I think we'd have to ask the same question of all the other various bloody accounts, wouldn't we?
I would guess that the obvious parallel with the story of Lot and the men of Sodom might have been implied in the relating of this event in Judges, though. It seems very similar, and was perhaps suggesting that Israel had gotten as bad as Sodom once was since this act of violence could happen. In that, it could be argued, is the 'wisdom' you may be looking for. Perhaps this shocking tale could serve as a serious wake-up call for people to get back to behaving like decent people instead of vicious, sick animals who would do this to a woman. Presumably the Law code would have called for the death penalty for the entire lot of them, based on their intentions, which would be breaking and entering and gay rape, right? So...I'm pretty sure enforcement of the Law or belief in its value might have caused these fellows to not do that. That's the best I can glean from it.
--sd-7