get_parents will find the parent of nested nodes, but sections aren't one of the nodes.
When I'm concerned with the section, I usually iterate over them like below. You could also iterate all nodes in reverse from the node of interest until you find a Heading node.
>>> for section in wikicode.get_sections(flat=True, include_lead=False):
... heading = section.filter_headings()[0].title.strip()
... for tpl in section.ifilter_templates():
... if tpl.name.matches("Template:Foo"):
... this = tpl
...
>>> this
'{{Template:Foo}}'
>>> heading
'foo'