The hat you speak of was the M34 and M37 Schirmutze or 'peak-caps'. Any NCO (corpral to sergeant ranks) was permitted to wear the hat like this one:
this one is infantry (has white piping) and has had the leather chinstrap removed.
Officer could wear one like this:
this one is recon (yellow piping) and has the officer's wound alluminum chinstrap.
So as you can see just because someone is wearing a hat doesn't mean that they are gestopo, if they were the piping on the cap would just be orange.