You are indeed thinking of the Vienna Convention on Diplomatic Relations of 1961. This codified a portion of existing customary international law on diplomatic immunity. It is the result of several years of legal negotiations at establishing a common set of rules that would be generally acceptable.
The basic concept of immunity for ambassadors is very ancient, and there is still a body of customary international law that was not codified. For example, the 1961 Convention only deals with permanent missions, not temporary ones like for multinational summits. The history and practice are also helpful for interpreting the Convention itself, such as when considering the scope of diplomatic duties which are protected, as opposed to extracurricular activities which might not be.
In the UK, the Convention is implemented by the Diplomatic Privileges Act 1964. This mostly repeats the relevant parts of the Convention text, in Schedule 1, and also includes sections integrating those provisions with domestic law. As far as the courts, section 4 says that
If in any proceedings any question arises whether or not any person is entitled to any privilege or immunity under this Act a certificate issued by or under the authority of the Secretary of State stating any fact relating to that question shall be conclusive evidence of that fact.
This means that what happens procedurally in a UK court is that someone wanting to claim immunity must come with a letter from the Foreign Secretary attesting that they are a real diplomat and not just making it up. The court then considers, from that fact, what legal consequences follow, depending on the type of diplomat involved (e.g. heads of mission have broader protection), the nature of the case (criminal case where the diplomat is accused? civil case where they are the respondent?), etc. That is a matter of interpreting the Convention, plus maybe customary international law - it doesn't mean the diplomat gets to wave their certificate and end the proceedings.
The purpose of section 4 is to avoid the court entering its own fact-finding process about whether someone is a real diplomat. That is felt to run the risk of the court causing diplomatic offence by accident - consider Israel and Palestine and China and Taiwan for potential pitfalls. The doctrine of "one voice" obliges the courts to follow the executive's lead.
Prior to the Act of 1964, diplomatic immunity was covered by several other enactments, but with the same basic model for implementing immunities in court. There were different regimes for Commonwealth countries and others, which is not the case any more. The first such Act was passed in 1708 after an embarrassing situation with the then ambassador from Russia, who was imprisoned for his debts, angering the Tsar.
In general, domestic courts in the UK can take account of customary international law if it is relevant. They can also look at treaty texts, even ones the UK has not signed, to help interpret international law. (In the same way, they can look at academic articles, travaux préparatoires, etc., which have no formal status as law.) If the UK signed the 1961 Convention but did not pass the 1964 Act, then courts might be able to treat the Convention as "background" - but would still be bound by the 1708-1955 Acts on the topic, as far as the actual procedure and rules to follow. A diplomat would not be able to avail themselves of their specific 1961 rights, unless perhaps there was some gap or ambiguity in the domestic law where they could squeeze in an argument that the Convention supplied the proper interpretation of whichever point of customary international law was involved.