In various Trek series, various crewmen are referred to by titles such as the following
Yeoman Third Class
Transporter Chief
Transporter Operator
Specialist
Technician
Crewman
Chief Petty Officer
etc.
I believe these to be related to enlisted personnel and non-commissioned officers, but Im not sure how to sort them out. Memory Alpha list NCO ranks as:
Master Chief Petty officer
Senior Chief Petty Officer
Chief Petty Officer
Petty Officer (1st, 2nd, and 3rd class)
Ordinary enlisted personnel are simply "Crewman" (as in Crewman Green, first victim of the Salt Vampire in "The Man Trap"). A Yeoman 3rd Class (like Tina Lawton in "Charlie X") would thus seem to be a Petty Officer, 3rd class, if I'm interpreting that correctly.
You're on the right track. Starfleet rank is derived from naval rank. Petty Officers and above are rated and their formal rank reflects their specialty. An E-5 who drives a bulldozer in the Seabees would be an equipment operator second class (EO2). An E-4 who deals with arms aboard ship would be a gunners mate third class (GM3). An E-9 who is a medic would be a Master Chief Hospital Corpsman (MCHC) and so an so forth. Petty Officer is the generic term and can be used interchangeably with their specific rate.
For E-1 through E-3 they have have base ranks of seaman, fireman (engineering), Airmen (aviation), Hospitalman (medical), and Constructionman. If they pass their qualifications, they can also be rated. A rated E-2 would be for instance, an Aviation Electrician Airmen Apprentice. It is unclear if Starfleet keeps rating at this level.
Chief O'Brien's status as a non-com is rather sloppily handled. On DS9 he basically did an officer's job, and to make matters even more odd, we sometimes saw ensigns and lieutenants reporting to him and taking orders from him. While I applaud the attempt to show Starfleet does have an enlisted side, it would have been nice if they could be consistent about it.
While there wasn't a whole lot of consistency, Senior Enlisted personnel giving marching orders to JOs does happen. When they say something to an officer it is generally assumed the order comes directly from the CO, XO, or a department head. If you value your carrer, you do what the Master Chief says.