The British Prime Minister will appear as a special guest in the heartthrobs' upcoming Comic Relief single 'One Way Or Another (Teenage Kicks)' - a mash-up of Blondie's 1979 song and the Undertones' 1978 track - and he shared his fun experience filming alongside the group on Twitter.
David posted a photograph of himself and the boys standing outside number 10 Downing Street on Sunday (17.02.13), alongside the caption: ''Enjoyed my cameo in @onedirection's vid for @comicrelief charity single. Glad to help with the filming location. (sic)''
The politician also wished the 'Kiss You' hitmakers luck in raising money for the cause - which aims to ''transform the lives of countless people, both here at home in the UK and across Africa'' - and confirmed he will contribute a generous donation of behalf of the government.
The group filmed part of their music video abroad in Japan and Ghana during their world tour, which they described as an ''amazing'' experience as well as being extremely emotional.
Speaking after a visit to the town Accra, Ghana, band member Harry Styles explained: ''We all had moments. If you get involved in it and you don't cry you're superhuman. We've seen appeal films before so we thought we knew what it's like, but when you're there and you get the smells, your eyes hurt from the smoke, you cough, you're feeling it all.
''The crazy thing is, when I went to school, not one person wanted to be there. Yet you go into a school in Ghana and every child loves it.''
One Direction will perform their new track at the BRIT Awards in London on Wednesday (20.02.13).
Comic Relief's Red Nose Day will air on BBC One on March 15.