The 31-year-old suffered cruciate ligament damage in February but was offered a new deal.
The former Falkirk, Sheffield United and Oldham player has re-signed for next season with a further one-year option.
Flynn told the club’s official website: “I’m delighted to get the deal sorted. It’s one that’s never been in doubt, it’s just been a case of circumstances with everything going on but I’m glad it’s sorted and I can just get on with rehab now.
“I’m feeling good at the minute. The 5-12 weeks mark was tough but I’m making real strides forward and I’m back jogging now which was nice. It feels like there is a bit of light at the end of the tunnel.
“I was enjoying my football last season before the injury and felt like the team was playing good football as well.
“There’s been a lot of change over the last few years but hopefully we’ll have a bit of stability and can hit the ground running at the start of the season rather than playing catch-up. We want to start where we left off and look to kick on.
“It’ll be our third year in the Premiership and we don’t want to be treading water. Hopefully we can look to what the likes of Livingston have done recently and do that ourselves.”
Manager Jim Goodwin added: “We’re delighted to have Ryan signed up for another year. He was brilliant for us last season up until his injury.
“He was excellent in midfield for us at the start of last season but injuries meant we had to move him to right-back and I felt he did even better there.
“He’s a top pro and a great person to have around the dressing room. I’ve enjoyed working with him and he’s a great example to the younger boys in the squad. Stability is a big thing in football and you need guys like him.”