Why do you believe that the timestamps are incorrect? Also, how does this relate to glQueryCounter?
Timestamps generated by glQueryCounter are taken at the point that all prior commands have completed. Those generated by glGetInteger are taken when the command is issued (i.e. after any buffered commands have been flushed but not necessarily executed).