Ainsley Francis, 57, monitored former partner Barbara Stokoe using a voice-activated device he bought on eBay and placed in her bedroom while she was out.
The bug, which was found concealed behind a plug socket next to her bed, sent messages to his mobile phone.
Following his arrest a total of 187 recordings were recovered from Francis’s phone and home computer of Ms Stokoe making calls, using the bathroom and even having sex.
Francis, who has served as a police officer for 29 years and had commendations for bravery, also allegedly sent his former wife threatening messages and entered her home while she was on holiday.
His behaviour was described as “devious, malicious and extraordinary to the point of being breathtaking” as he was jailed at Maidstone Crown Court.
The court heard Francis and Ms Stokoe had gone through “acrimonious” divorce proceedings after separating in 2012.
They lived in different homes but Francis continued to visit his ex-wife and their son William in Ditton, Maidstone.
Francis began stalking her in May 2014, according to prosecutors, who said he repeatedly drove past her home, bombarded her with emails and phone calls and asked her for photos of herself.
He also threatened violence against her new partner Anthony Lock, described details of bedding used by the pair and alluded to their trips away to Ireland and Germany, the court heard.
“It was clear from the messages that Mr Francis was sending to Ms Stokoe at this time that he was familiar with her movements,” said prosecutor Richard Job.
When Ms Stokoe and her partner returned from holiday in India they discovered that someone had turned off the freezer in the garage and left the food to defrost.
After confronting him about the visits, her divorce solicitors sent him a letter warning him about his behaviour.
It was only in March last year that her partner discovered the secret recording device, a circuit board connected to a SIM card, in her bedroom.
The prosecutor described it as “sinister” and added that it “might be described in espionage movies or novels as a bug”.
Following his arrest, Francis claimed he used the device because he was “seeking to prevent the commission of crime”.
Ms Stokoe said in a statement to the court that Francis’s actions had “completely changed her life” and left her with feelings of “violation, helplessness and intimidation”.
His barrister Edmund Gritt said Francis apologised to his ex-wife and Mr Lock for their “disgraceful treatment”.
Judge David Griffith-Jones QC told the officer: “You seek to advance a form of explanation for your behaviour over that extended period of time by saying you had lost perspective.
“That seems to me to be an understatement and inappropriate sanitisation of what amounted to out and out criminal behaviour driven by some form of twisted jealousy and determination to control, and be seen to control, your estranged wife in her new circumstances.”
Francis, who lived in Maidstone but worked for the Metropolitan Police in Forest Gate, east London, was sentenced to 45 months imprisonment after pleading guilty to stalking involving fear of violence or serious alarm or distress.
He was also banned from contacting Ms Stokoe by an indefinite restraining order.
Detective Constable Tony Hatcher of Kent Police said: “Francis’s actions have had a huge impact on both the victim’s wellbeing and daily life.
“His relentless campaign of harassment and unwanted attention was compounded by way of the listening device that he installed in her bedroom.
“This was a gross intrusion of privacy and there is little doubt the victim will have been left feeling violated and suffering profound distress and fear.”
Additional reporting by Press Association