Besides, he said in an episode that when he enlisted he studied engineering.
I'm not familiar with that reference.
In rough in-universe chronological order:
* "Shadowplay" establishes that Miles escaped cello studies at the age of seventeen by "signing up for" Starfleet . That's probably different from enrolling in Starfleet Academy, as there's no evidence Miles ever went to the Academy.
* "Paradise" has Miles saying that "It wasn't till I got to the Cardassian front I found I had talents I never knew I had" and " I didn't know a transporter from a turbolift in those days" - until he had to rescue a landing party from Setlik III by repairing a field transporter. This appears to be the same incident he describes in "The Wounded", where Cardassian irregulars raided Setlik III and ambushed the landing party of USS Rutledge
. O'Brien goes on in "Paradise" to say that after this incident, he became the Tactical Officer of said starship (a career move we already knew from "The Wounded") and began wearing gold.
* In "Realm of Fear", O'Brien says he has operated transporters for 22 years, so he must be counting from this incident at Setlik III, placing it at 2347. He doesn't necessarily mean he has been doing that constantly between 2347 and the episode, though.
* In "Tribunal", O'Brien says he was involved in a battle at Setlik III also in what adds up to 2362, and in "Empok Nor" he expands that he fought entire regiments of Cardassian regulars there. It thus seems that O'Brien did not immediately transform from foot soldier to engineer or transporter operator, but rather continued as a ground fighter of some sort (either in the role of Rutledge
Tactical Officer, as he was still associated with that ship as per "Tribunal", or then in some subsequent role such as Security Chief or Marine Sergeant or whatnot).
* Then in 2363 (or '64, depending on how you count) comes "All Good Things..." where O'Brien, in red, comes aboard the E-D in an unknown role. Also, the time-traveling Picard encourages O'Brien to start doing engineering, at which point it is revealed that building of starship engine models was among O'Brien's childhood hobbies. Miles says that what Picard asks of him is not "his area of expertise", but he doesn't say he completely lacks engineering skills or training, so he may have acquired them at some point after Setlik III (either the 2347 or the 2362 fight). Then O'Brien gets sent to pilot the Battle Section still in his red uniform in the "Encounter at Farpoint" version of the same events.
* In "Lonely Among Us" O'Brien is wearing gold, possibly having become Transporter Chief already. He is seen maintaining order, or at least telling people where not to go, but that doesn't necessarily make him a Security officer by formal status. It's probably in his blood, though.
* The rest of TNG is spent in the Transporter Chief role.
* DS9 opens with O'Brien becoming Chief of Ops. In a usually cut scene, Picard says goodbye to him, and the two talk about nothing but the Chief's transporter role; no retraining or the like is mentioned.
* "A Man Alone" establishes that O'Brien's assignment on DS9 was a "promotion" even though we never see his actual rank change. It's also a promotion he will lose if he moves elsewhere. Apparently, then, this would be the first time O'Brien would have engineering leadership duties.
* "What You Leave Behind" has Molly O'Brien saying that daddy is going to teach at the Academy after the war. Whether that's true at the time, and whether that really happens after the war, we never quite learn.