One thing is for certain, if your neighbor challenged (in traffic court, or w/e the hell it is called) the officers decision, your neighbor would win hands down, and the cop would most certainly get some kind of reprimand for his actions.
The reason why the cop was violating the law:
1) You can't "tail" someone to "pre-meditatively" pull them over for a violation they haven't (and ultimately have not) committed. In fact, the action described in the OP is stalking and it is very criminal. Your neighbor should've gotten the officer's name and badge number before speaking with the officer and before the officer tried to give him any kind of trouble, your neighbor should've called the police. Sounds stupid, but what if this was someone posing as a police officer? Especially at that time at night? You should get their name and badge num. and call the cops and have them come down. This will either: 1) humiliate the officer into letting you go and leaving, or 2) cause another officer to come on the spot and at the very least tell him how much of a dickhead the first officer is being and then hopefully they will leave. Another thing, if another township cop comes and says the same thing the first officer said, then call the state police, because what they're doing is harrassment and it is ILLEGAL.
2) You can't pull someone over who is driving home in effect to not violate the law. There is no sense in pulling someone over for breaking a "curfew" when the very thing that depends on whether or not they can adhere to the curfew is driving in the car and to their own house.
3) (And this is the big one) The "3 minutes" claim by the officer. And who the hell's watch are we getting this from? Nobody's watch is perfect, the kid's car clock could've even said he was in the clear and it was well before midnight. Is this kid just supposed to subject himself to the officer's opinion of what time it is? The answer is no. You cannot slap someone with a violation like this one if they "potentially" had no idea they were in violation of the curfew because their clock said they were ok. Just because it's "near" midnight the cop can say whatever he pleases just to slap someone with a violation and a fine just so they can make money for their township, and that is most certainly illegal. By upholding the officer's decision the court would be allowing all officers to go around slapping people with curfew violations who are in fact not committing said violations and that is illegal.