Flanagan was elected to represent the Roscommon–South Leitrim constituency in the 31st Dáil in the 2011 general election, one of twenty members of the New Vision alliance of independent candidates. He received 8,925 (18.8%) first preference votes, which enabled him to take the first seat with 12,149 votes on the fourth count, while the two incumbent Fine Gael TDs were elected on the sixth count. Neither of the two Fianna Fáil candidates managed to retain the seat of their retiring party colleague, Michael Finneran.
When he was elected in 2011, Flanagan kept his promise to retain only half of his €92,672 salary and distribute the rest to local projects. He refused to hand it back to the State, claiming it would only be pumped into the banks.
In March 2011, one month after being elected to Dáil Éireann, Flanagan announced that he would cease his smoking of cannabis while in Ireland in order to protect his family and focus on the issues for which he stands. He said he still intended to smoke cannabis when abroad. This followed a formal complaint lodged to the Garda Síochána by a Fianna Fáil councillor from Kilkenny about his cannabis use. Flanagan said that: "...my wife and children are the most important people on the planet to me and I don't want my kids to witness the Garda calling to the house." He said he would continue to campaign for the legalisation of cannabis.
In July 2011, Flanagan was linked to an incident in which a Dáil microphone picked up a conversation he had with fellow independent TDs Shane Ross and Mick Wallace. During the exchange the trio appeared to be disparaging the appearance of Fine Gael TD Mary Mitchell O'Connor. Wallace initiated the conversation by saying "Miss Piggy has toned it down a bit today". Flanagan was heard saying "they’d want to ban her wearing pink" and Ross commented that "she normally wears the most garish colours".
On 2 November 2011, Flanagan walked out of the Dáil amid a heated disagreement with Minister for Agriculture, Food and the Marine, Simon Coveney over turf-cutting rights. Flanagan had observed that his Fine Gael constituency colleague Frank Feighan had promised before the 2011 general election that he would "sign his name in blood" if that was required in order to oppose a turf-cutting ban, with Coveney responding by saying populism was a dangerous thing. Flanagan then said, "Populism and bondholders. I am leaving the chamber"; Coveney then told him to "go on and walk out in protest". Flanagan retorted, "My daddy did not give me a seat." This referred to the fact that Coveney had been elected in a by-election after his father Hugh Coveney TD died in an accident in March 1998.
On 15 December 2011, Flanagan helped launch a nationwide campaign against a proposed household charge being brought in as part of the 2012 Irish budget.