The verse in question is Judges 14:4 - "But his father and his mother knew not that it was of the LORD, that he sought an occasion against the Philistines: for at that time the Philistines had dominion over Israel."
This verse is one of many in the Bible showing that God turns the evil desires and acts of men to His own purpose. The parents of Samson knew that it was wrong on a personal basis for Samson to marry a Philistine--although from my research I do not find a specific command concerning marriage to the Philistines (Deuteronomy 7:1-3 refers to other Canaanite nations). However, God would use his act of rebellion and lust to His own end. God would use it to create conflict with the Philistines.
If this seems impossible, consider Genesis 50:20. The brothers of Joseph in unrighteous hatred sold him as a slave. Yet, years later Joseph testified, "But as for you, ye thought evil against me; but God meant it unto good, to bring to pass, as it is this day, to save much people alive." This does not mean that the brothers did not sin in selling Joseph. It means that God would use their sin for a higher purpose.
These verses do not lessen the righteousness of God or His demands for holiness. Neither do they excuse men for sin. What they show is that man cannot help fulfilling the will of God in one way or another. The accomplishment of God's greater will is not dependent upon the cooperation of man. If this seems impossible, consider Psalm 76:10 - "Surely the wrath of man shall praise thee: the remainder of wrath shalt thou restrain." God states that the wrath of man will give praise to God. Any wrath that will not bring praise to God will be restrained. God will get the glory no matter what.
Our choice is not whether or not the things we do turn to the glory of God. No matter what we do, God will get the glory--even if that glory is in proving His righteousness by judging our sin. Our decisions have to do with whether or not we take part of that glory in a good way.
To use the events in the life of Samson as a pattern to follow is a dangerous plan. Yes, God got the glory and accomplished His will, but what happened in the life of Samson? If Samson had been submissive to the will of God and close to the Lord, could not the Lord have found a way that would bring a blessing to Samson? You see, in the end all men will fulfill the will of God. The question is, how will they do it? Will they do it willingly and receive a blessing and a reward? Or, will they fulfill God's will in their rebellion to Him and suffer the consequences?