Section 107 provides a means by which problems resulting from ultra vires provisions of Acts of the Scottish Parliament or actions of a member of the Scottish Executive may be remedied.
It allows the UK Government, by subordinate legislation to make such provision as is considered necessary or expedient in consequence of any Act of the Scottish Parliament (or provision thereof) which is not, or may not be, within the legislative competence of the Parliament or any purported exercise by member of the Scottish Executive of a function which is, or is suspected to be, ultra vires.
The situations in which this power may be used would include a situation where, after judicial deliberation, it was determined that a provision of an Act of the Scottish Parliament, was ultra vires.  This power would allow the ASP to be amended and enable provision to be made to remedy any consequential problems, for example, concerning rights purportedly accrued or liabilities purportedly incurred by virtue of the Act.  Such provision could be given retrospective effect thus putting third parties in the position they thought they were in before the flaw was discovered.  In that sense this power is complementary to the power given to the courts in section 102 to limit or suspend the effect of a determination of ultra vires.
However, a determination by the courts that a provision or action is ultra vires is not a prerequisite for the use of this power.  It could be used to remedy a defect, or suspected defect, before judicial proceedings were commenced thereby avoiding the necessity for them.
Further provision about the making of subordinate legislation is to be found in sections 112 to 115 and Schedule 7.
The only occasion where this power has been used was to repeal a provision in an ASP which was discovered to relate to a reserved matter during the 4 week period after its passing. Instead of referring it to the JCPC under section 33, it was agreed between the UK Government and the Executive that it should be repealed as soon as the ASP had received the Royal Assent - see The Scotland Act 1998 (Regulation of Care (Scotland) Act 2001) Order 2001 (S.I. 2001/12478).
Commentary Part V: Miscellaneous and General Details of Provisions