Sondhi, who played PC Maneet Bindra in the BBC One series, suggested that screenwriter Mercurio wrote her out of one of the most popular shows on TV, but it led to them working together on the first series she has penned where she said she learned plenty from the king of police procedurals.
Mercurio, who executive produces DI Ray, said: "We were at lunch during filming, and Maya just said, 'In the next series, I’d love a meaty death scene'. So that was it for Maneet! It was easier for me than having to force a character death on an actor.
"So we talked about giving her a really strong arc into the death sequence so that it would have the maximum impact."
Viewers saw Maneet, who had been caught up in police corruption, brutally murdered by the OCG. But it was not the end of police work for Sondhi, as she began discussions with Mercurio about her own writing at the same lunch where she suggested her character's death.
Explaining that she wanted to write about her own experiences of identity as a British Asian woman, she said: "Jed said I just had to make it accessible to people, and suggested wrapping it up in a police procedural, because there aren't enough of them!"
Sondhi said she had panicked over making the police scenes realistic in DI Ray, admitting: "I didn't want to write a rubbish Line Of Duty."
But Mercurio said he had helped her out after having the same experience a few years earlier: "When I first started writing Line Of Duty, I'd never written a police drama before and the first few months of trying to crack the script involved me looking up the absolute basics of police procedure and reading around the subject."
DI Ray stars Bend It Like Beckham's Parminder Nagra as a recently-promoted detective who is disappointed when she feels she has been given an apparent honour killing case as a tokenistic appointment, but soon finds there is much more to the crime than meets the eye.
Sondhi told how executive producer Mercurio, known for his plot twists, had helped her hone her writing: "I could just write two people talking in a room for hours, but I've learned so much from Jed about how to hook in audiences and keep them watching.
"There are probably a few ‘Jed influenced’ plot twists in there – not red herrings, or 'Jed herrings' as we call them, but hopefully a few surprises."
Meanwhile, Mercurio shared that he isn't about to give up thrillers like Line Of Duty and Trigger Point any time soon, but surprisingly would love to work on a comedy.
He said: "I really enjoy writing thrillers! I'm a fan of them, so it does feel like I'm probably going to stay in that genre. I mean there are obviously sub-genres for thrillers and I'm not entirely sure what kinds of thrillers I'm going to be writing over the next few years.
"I did a comedy early in my career when I was trying to find my place in the industry and I loved it, but I can't see myself going back to it, unless I was producing rather than writing. I’d love to exec produce a comedy."
DI Ray airs from 2 to 5 May at 9pm on ITV.
Watch: Kelly Macdonald compares Operation Mincemeat to Line Of Duty